@dripfi/drip-sdk 1.3.10 → 1.3.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/CHANGELOG.md +12 -0
- package/README.md +310 -238
- package/dist/DripApi.d.ts +1 -16
- package/dist/DripApi.js +0 -20
- package/dist/DripConfig.d.ts +2 -2
- package/dist/DripConfig.js +3 -3
- package/dist/DripSdk.d.ts +1 -16
- package/dist/DripSdk.js +8 -19
- package/dist/abi/index.d.ts +2 -2
- package/dist/abi/index.js +4 -4
- package/dist/contracts/{DripSwapAndRecyclerContract.d.ts → PerqSwapAndRecyclerContract.d.ts} +2 -2
- package/dist/contracts/{DripSwapAndRecyclerContract.js → PerqSwapAndRecyclerContract.js} +5 -5
- package/dist/contracts/{DripTokenContract.d.ts → PerqTokenContract.d.ts} +2 -2
- package/dist/contracts/{DripTokenContract.js → PerqTokenContract.js} +5 -5
- package/dist/contracts/{DripTokenRecyclerContract.d.ts → PerqTokenRecyclerContract.d.ts} +1 -1
- package/dist/contracts/{DripTokenRecyclerContract.js → PerqTokenRecyclerContract.js} +2 -2
- package/dist/contracts/PerqVestingContract.d.ts +2 -2
- package/dist/contracts/PerqVestingContract.js +2 -2
- package/dist/contracts/index.d.ts +13 -0
- package/dist/contracts/index.js +17 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.js +9 -31
- package/dist/perq/PerqConfig.d.ts +1 -1
- package/dist/perq/PerqConfig.js +3 -3
- package/dist/perq/PerqSdk.d.ts +1 -1
- package/dist/types/Chain.d.ts +2 -1
- package/dist/types/Chain.js +2 -2
- package/dist/types/DeployedProject.d.ts +1 -2
- package/dist/types/DeployedVault.d.ts +1 -3
- package/dist/types/LoyaltyCard.d.ts +1 -1
- package/dist/types/MyPerqData.d.ts +1 -2
- package/dist/types/Vault.d.ts +2 -7
- package/dist/types/YelayVersion.d.ts +2 -1
- package/dist/types/index.d.ts +10 -11
- package/dist/types/index.js +3 -1
- package/package.json +1 -1
- package/dist/types/CacheVaultRewards.d.ts +0 -14
- package/dist/types/CacheVaultRewards.js +0 -2
- package/dist/types/UserBalance.d.ts +0 -19
- package/dist/types/UserBalance.js +0 -2
- package/dist/types/VaultClaimData.d.ts +0 -7
- package/dist/types/VaultClaimData.js +0 -2
- package/dist/types/VaultDepositToken.d.ts +0 -8
- package/dist/types/VaultDepositToken.js +0 -2
- /package/dist/abi/{DripSwapAndRecyclerAbi.json → PerqSwapAndRecyclerAbi.json} +0 -0
- /package/dist/abi/{DripTokenAbi.json → PerqTokenAbi.json} +0 -0
- /package/dist/contracts/{BaseDripContract.d.ts → BasePerqContract.d.ts} +0 -0
- /package/dist/contracts/{BaseDripContract.js → BasePerqContract.js} +0 -0
package/README.md
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
## Introduction
|
4
4
|
|
5
|
-
The Drip SDK is a TypeScript library designed to interact with the
|
5
|
+
The Drip SDK is a TypeScript library designed to interact with the Perq protocol. It provides methods to retrieve information about Perq Vaults, manage user authentication, and fetch user balances.
|
6
6
|
|
7
7
|
## Table of Contents
|
8
|
+
|
8
9
|
- [Installation](#installation)
|
9
10
|
- [Usage](#usage)
|
10
11
|
- [Methods](#methods)
|
@@ -23,8 +24,8 @@ npm i @dripfi/drip-sdk
|
|
23
24
|
# Usage
|
24
25
|
|
25
26
|
```typescript
|
26
|
-
import DripSdk from '@drip/sdk'
|
27
|
-
import { DripConfig, Chain } from '@dripfi/drip-sdk'
|
27
|
+
import DripSdk from '@drip/sdk';
|
28
|
+
import { DripConfig, Chain } from '@dripfi/drip-sdk';
|
28
29
|
```
|
29
30
|
|
30
31
|
Initialize the SDK with your Drip configuration and an optional signer:
|
@@ -42,51 +43,51 @@ const dripSdk = new DripSdk(chain, signer);
|
|
42
43
|
|
43
44
|
# Methods
|
44
45
|
|
45
|
-
| Name
|
46
|
-
|
|
47
|
-
| `getAllVaults(): Promise<Vault[]
|
48
|
-
| `getVaultDetails(vaultAddress: string): Promise<Vault>`
|
49
|
-
| `getVaultStats(): Promise<VaultStats
|
50
|
-
| `getTokenPrice(tokenName: string): Promise<number
|
51
|
-
| `updateSigner(newSigner: Signer): Promise<void
|
52
|
-
| `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>`
|
53
|
-
| `getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string
|
54
|
-
| `
|
55
|
-
| `
|
56
|
-
| `
|
57
|
-
| `
|
58
|
-
| `
|
59
|
-
| `
|
60
|
-
| `
|
61
|
-
| `
|
62
|
-
| `
|
63
|
-
| `
|
64
|
-
| `
|
65
|
-
| `
|
66
|
-
| `
|
67
|
-
| `
|
68
|
-
| `
|
69
|
-
| `
|
70
|
-
| `
|
71
|
-
| `
|
72
|
-
| `
|
73
|
-
| `
|
74
|
-
| `
|
75
|
-
| `
|
76
|
-
| `
|
77
|
-
| `getOwnedLoyaltyCard(): Promise<LoyaltyCard>` | YES | This function fetches the currently owned loyalty card of the connected wallet.
|
78
|
-
| `getAllLoyaltyCards(): Promise<LoyaltyCard[]>` | YES | This function fetches all available loyalty cards.
|
46
|
+
| Name | Description |
|
47
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
48
|
+
| `getAllVaults(): Promise<Vault[]>` | Fetches details of all Perq Vaults. |
|
49
|
+
| `getVaultDetails(vaultAddress: string): Promise<Vault>` | Fetches details of a specific Perq Vault identified by its address. |
|
50
|
+
| `getVaultStats(): Promise<VaultStats>` | Returns some overall Perq stats |
|
51
|
+
| `getTokenPrice(tokenName: string): Promise<number>` | Returns the price for the given token (only works for weth at the moment) |
|
52
|
+
| `updateSigner(newSigner: Signer): Promise<void>` | Updates the signer for the SDK instance. |
|
53
|
+
| `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>` | The deposit function allows you to deposit tokens into a specific vault. Returns txHash. |
|
54
|
+
| `getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>` | Returns the expected amount of tokens to get from a swap |
|
55
|
+
| `getRewardsPerHour(vaultAddress: string): Promise<string[]>` | Returns an estimated amount of tokens the user will receive in 1 hour as reward. It considers boost nfts the user owns for the estimation. |
|
56
|
+
| `getRewards(): Promise<UserRewards>` | Fetches the current user's rewards points for each vault. |
|
57
|
+
| `getUserVaultBalance(): Promise<UserVaultBalance>` | Fetches the user's balance for a specific Perq Vault. |
|
58
|
+
| `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<string>` | 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. |
|
59
|
+
| `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>` | 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. |
|
60
|
+
| `withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>` | 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. |
|
61
|
+
| `claimWithdraws(vaultAddress: string): Promise<string>` | After the withdrawal has been processed by the 'DoHardWork' function, the 'claimWithdraws' function transfers the withdrawn tokens to their personal account. Returns txHash. |
|
62
|
+
| `getTokenAllowanceForCurrency(tokenAddress: string): Promise<string>` | Retrieves the token allowance for a specific currency. |
|
63
|
+
| `getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the recycler contract. |
|
64
|
+
| `getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the swap and recycler contract. |
|
65
|
+
| `getUserBoostedNfts(vaultAddress: string): Promise<string[]>` | Retrieves an array of boosted NFT addresses owned by the user. |
|
66
|
+
| `getRewardsPerHour(vaultAddress: string): Promise<number> ` | Returns an estimated amount of tokens the user will receive in one hour as a reward for the given vault |
|
67
|
+
| `newDeposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>` | Allows for a new deposit without checking for allowance. |
|
68
|
+
| `newSwapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string> ` | Allows for a new swap and deposit without checking for allowance. |
|
69
|
+
| `getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo>` | Retrieves all vesting information for a specified beneficiary. |
|
70
|
+
| `getVestingStart(): Promise<string>` | Retrieves the start time of the vesting period. |
|
71
|
+
| `getVestingEnd(): Promise<string>` | Retrieves the end time of the vesting period. |
|
72
|
+
| `getBeansHistory(): Promise<BeanEntry[]> ` | Retrieves the user's beans history of tx |
|
73
|
+
| `getBeansBalance(): Promise<BeansBalance> ` | Retrieves the user's beans balance. |
|
74
|
+
| `getMyPerqBalance(): Promise<MyPerqData>` | Retrieves the user's Perq balance data. |
|
75
|
+
| `upgradeLoyaltyCard(index: number): Promise<LoyaltyCard>` | Upgrades the user's loyalty card. |
|
76
|
+
| `getOwnedLoyaltyCard(): Promise<LoyaltyCard>` | Fetches the currently owned loyalty card of the connected wallet. |
|
77
|
+
| `getAllLoyaltyCards(): Promise<LoyaltyCard[]>` | Fetches all available loyalty cards. |
|
79
78
|
|
80
79
|
---
|
81
80
|
|
82
81
|
# Examples
|
83
82
|
|
84
|
-
### `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>`
|
83
|
+
### `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>`
|
85
84
|
|
86
85
|
I want to deposit 100 USDC in a USDC vault:
|
86
|
+
|
87
87
|
```typescript
|
88
88
|
USDC_TOKEN_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" --> USDC contract address in tenderly environment
|
89
89
|
```
|
90
|
+
|
90
91
|
you can get vault token address from the vault.depositToken.tokenAddress
|
91
92
|
|
92
93
|
```typescript
|
@@ -108,7 +109,7 @@ const txHash = await deposit(USDC_TOKEN_ADDRESS, VAULT_ADDRESS, '100')
|
|
108
109
|
|
109
110
|
---
|
110
111
|
|
111
|
-
### `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>`
|
112
|
+
### `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>`
|
112
113
|
|
113
114
|
I want to deposit 1.5ETH in a WETH vault:
|
114
115
|
|
@@ -117,6 +118,7 @@ WETH_TOKEN_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --> WETH co
|
|
117
118
|
|
118
119
|
const txHash = await swapAndDeposit(WETH_TOKEN_ADDRESS, WETH_TOKEN_ADDRESS, '0', vaultAddress, '1.5')
|
119
120
|
```
|
121
|
+
|
120
122
|
you can get vault token address from the vault.depositToken.tokenAddress
|
121
123
|
|
122
124
|
> [!IMPORTANT]
|
@@ -124,12 +126,13 @@ you can get vault token address from the vault.depositToken.tokenAddress
|
|
124
126
|
|
125
127
|
---
|
126
128
|
|
127
|
-
### `withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>`
|
129
|
+
### `withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>`
|
128
130
|
|
129
131
|
```typescript
|
130
|
-
|
131
|
-
|
132
|
+
const userBalanceObject = await getUserBalance();
|
133
|
+
const balance = userBalanceObject.userbalance;
|
132
134
|
```
|
135
|
+
|
133
136
|
> [!NOTE]
|
134
137
|
> If i check balance, that is the max amount I can withdraw
|
135
138
|
|
@@ -137,42 +140,45 @@ I want to withdraw 100 USDC from the 1st vault fetched. ---> Let's assume the fi
|
|
137
140
|
Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (100 in this example)
|
138
141
|
|
139
142
|
```typescript
|
140
|
-
const vaults = await getAllVaults()
|
141
|
-
const vaultToWithdrawFrom = vaults[0]
|
143
|
+
const vaults = await getAllVaults();
|
144
|
+
const vaultToWithdrawFrom = vaults[0];
|
142
145
|
|
143
|
-
const txHash = await withdraw(vaultToWithdrawFrom, '100')
|
146
|
+
const txHash = await withdraw(vaultToWithdrawFrom, '100');
|
144
147
|
```
|
145
148
|
|
146
149
|
if you want to withdraw all funds in the vault, don't specify the amountToWithdraw:
|
147
150
|
|
148
151
|
```typescript
|
149
|
-
const txHash = await withdraw(vaultToWithdrawFrom)
|
152
|
+
const txHash = await withdraw(vaultToWithdrawFrom);
|
150
153
|
```
|
154
|
+
|
151
155
|
> [!IMPORTANT]
|
152
156
|
> you will have to claim your withdraws after DHW is processed to transfer the withdrawn funds to your wallet
|
153
157
|
|
154
158
|
---
|
155
159
|
|
156
|
-
### `claimWithdraws(vaultAddress: string): Promise<string>`
|
160
|
+
### `claimWithdraws(vaultAddress: string): Promise<string>`
|
157
161
|
|
158
162
|
```typescript
|
159
|
-
|
160
|
-
|
163
|
+
const userBalanceObject = await getUserBalance();
|
164
|
+
const hasWithdrawsToClaim = userBalanceObject.hasWithdrawsToClaim;
|
161
165
|
```
|
162
|
-
|
166
|
+
|
167
|
+
if hasWithdrawsToClaim is true you have available funds to transfer to your address
|
163
168
|
|
164
169
|
```typescript
|
165
|
-
|
170
|
+
const txHash = await claimWithdraws();
|
166
171
|
```
|
172
|
+
|
167
173
|
It will transfer all available funds withdrawn with withdraw() function, to your address
|
168
174
|
|
169
175
|
---
|
170
176
|
|
171
|
-
### `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<string>`
|
177
|
+
### `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<string>`
|
172
178
|
|
173
179
|
```typescript
|
174
|
-
|
175
|
-
|
180
|
+
const userBalanceObject = await getUserBalance();
|
181
|
+
const balance = userBalanceObject.userbalance;
|
176
182
|
```
|
177
183
|
|
178
184
|
> [!NOTE]
|
@@ -182,236 +188,302 @@ I want to withdraw 3.55 WETH from the 1st vault fetched. ---> Let's assume the f
|
|
182
188
|
Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (3.55 in this example)
|
183
189
|
|
184
190
|
```typescript
|
185
|
-
const vaults = await getAllVaults()
|
186
|
-
const vaultToWithdrawFrom = vaults[0]
|
191
|
+
const vaults = await getAllVaults();
|
192
|
+
const vaultToWithdrawFrom = vaults[0];
|
187
193
|
|
188
|
-
const txHash = await fastWithdraw(vaultToWithdrawFrom, '3.55')
|
194
|
+
const txHash = await fastWithdraw(vaultToWithdrawFrom, '3.55');
|
189
195
|
```
|
190
196
|
|
191
197
|
if you want to withdraw all funds in the vault, don't specify the amountToWithdraw, like:
|
192
198
|
|
193
199
|
```typescript
|
194
|
-
const txHash = await fastWithdraw(vaultToWithdrawFrom)
|
200
|
+
const txHash = await fastWithdraw(vaultToWithdrawFrom);
|
195
201
|
```
|
196
202
|
|
197
203
|
# Types
|
198
204
|
|
199
205
|
```typescript
|
200
|
-
type
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
strategies: Strategy[]
|
216
|
-
tgePrice?: number
|
217
|
-
maxAmountOfTokens?: number
|
218
|
-
project: DeployedProject
|
219
|
-
projectId: number
|
220
|
-
coingeckoId?: string
|
221
|
-
depositTokenId: string
|
222
|
-
expectedTge?: string
|
223
|
-
tokenPrice: number
|
224
|
-
change24h: number
|
225
|
-
volume24h: number
|
226
|
-
projectFeatured: boolean
|
227
|
-
avgTvl: string
|
228
|
-
peakTvl: string
|
229
|
-
amountOfDepositors: number
|
230
|
-
boostedTvl: number
|
231
|
-
projectVAPY?: number
|
206
|
+
type Asset = {
|
207
|
+
decimals: number;
|
208
|
+
symbol: string;
|
209
|
+
};
|
210
|
+
|
211
|
+
type BeanEntry = {
|
212
|
+
address: string;
|
213
|
+
reason: string;
|
214
|
+
recycledAmount: string;
|
215
|
+
beansAmount: string;
|
216
|
+
beansSum: string;
|
217
|
+
amountDepositedInUsd: string;
|
218
|
+
createdAt: string;
|
219
|
+
chainId: number;
|
220
|
+
nonce: number;
|
232
221
|
};
|
233
222
|
|
234
|
-
type
|
223
|
+
type BeansBalance = {
|
224
|
+
balance: string;
|
225
|
+
bonusesClaimed: string[];
|
226
|
+
};
|
235
227
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
roundingDecimals: number
|
240
|
-
precisionDecimals: number
|
241
|
-
tokenAddress: string
|
228
|
+
enum Chain {
|
229
|
+
MAINNET = 'mainnet',
|
230
|
+
SEPOLIA = 'sepolia',
|
242
231
|
}
|
243
232
|
|
244
|
-
type
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
233
|
+
type DeployedProject = {
|
234
|
+
id: number | undefined;
|
235
|
+
projectName: string;
|
236
|
+
owners: string[];
|
237
|
+
logo: string;
|
238
|
+
telegramLink: string;
|
239
|
+
twitterLink: string;
|
240
|
+
mediumLink: string;
|
241
|
+
deckLink: string;
|
242
|
+
roadmapLink: string;
|
243
|
+
economicsLink: string;
|
244
|
+
discordLink: string;
|
245
|
+
docsLink: string;
|
246
|
+
whitepaperLink: string;
|
247
|
+
litepaperLink: string;
|
248
|
+
websiteLink: string;
|
249
|
+
supplyAtLaunch: number;
|
250
|
+
fdv: number;
|
251
|
+
latestRoundPriceInUsd: number;
|
252
|
+
totalSupply: number;
|
253
|
+
disabledTgePrice: boolean;
|
254
|
+
backers: ProjectBacker[];
|
255
|
+
networks: string[];
|
256
|
+
content: string;
|
257
|
+
tgeDate?: string;
|
258
|
+
tgePrice?: number;
|
259
|
+
vAPY?: number;
|
260
|
+
wikiLink: string;
|
261
|
+
youTubeLink: string;
|
262
|
+
tikTokLink: string;
|
263
|
+
stretchGoals: StretchGoal[];
|
264
|
+
projectInfoText: string;
|
265
|
+
projectRewardText: string;
|
266
|
+
coingeckoId?: string;
|
267
|
+
projectType: string;
|
268
|
+
isFeatured: boolean;
|
269
|
+
yelayVersion: YelayVersion;
|
255
270
|
};
|
256
271
|
|
257
|
-
type
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
272
|
+
type DeployedVault = {
|
273
|
+
projectId: number;
|
274
|
+
vaultAddress: string;
|
275
|
+
liveUntil: string;
|
276
|
+
liveFrom: string;
|
277
|
+
type: VaultType;
|
278
|
+
depositTokenId: string;
|
279
|
+
rewards: VaultReward[];
|
280
|
+
project?: DeployedProject;
|
281
|
+
coingeckoId?: string;
|
282
|
+
expectedTge?: string;
|
283
|
+
};
|
266
284
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
}
|
285
|
+
type DepositToken = {
|
286
|
+
name: string;
|
287
|
+
symbol: string;
|
288
|
+
roundingDecimals: number;
|
289
|
+
precisionDecimals: number;
|
290
|
+
tokenAddress: string;
|
291
|
+
};
|
274
292
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
293
|
+
enum ELoyaltyCardTier {
|
294
|
+
White = 'White',
|
295
|
+
Ivory = 'Ivory',
|
296
|
+
Dune = 'Dune',
|
297
|
+
Amber = 'Amber',
|
298
|
+
Sienna = 'Sienna',
|
299
|
+
Umber = 'Umber',
|
300
|
+
Black = 'Black',
|
279
301
|
}
|
280
302
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
}
|
289
|
-
claimed: string
|
290
|
-
id: string
|
291
|
-
}[]
|
292
|
-
blockNumber: number
|
293
|
-
id: string
|
294
|
-
svtWithdrawn: string
|
295
|
-
}
|
303
|
+
type LoyaltyCard = {
|
304
|
+
id: string;
|
305
|
+
tier: ELoyaltyCardTier;
|
306
|
+
level: number;
|
307
|
+
cost: number;
|
308
|
+
boost: number;
|
309
|
+
};
|
296
310
|
|
297
|
-
type
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
311
|
+
type MyPerqData = Vault & {
|
312
|
+
claimable: number;
|
313
|
+
pendingDeposits: number;
|
314
|
+
pendingWithdraws: number;
|
315
|
+
currentlyDeposited: number;
|
316
|
+
ethPrice: number;
|
317
|
+
tokenRewards: { [token_address: string]: Asset & { amount: number; rewardsPerHour?: number } };
|
318
|
+
};
|
302
319
|
|
303
|
-
type
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
decimals: number,
|
312
|
-
reward: number
|
313
|
-
}[],
|
314
|
-
available: { [symbol: string] : number},
|
315
|
-
claimed: { [symbol: string] : number},
|
320
|
+
type NFTBoost = {
|
321
|
+
url: string;
|
322
|
+
tokenAddress: string;
|
323
|
+
multiplier: number;
|
324
|
+
nftAddress: string;
|
325
|
+
network: string;
|
326
|
+
initialBlock: number;
|
327
|
+
imagePath: string;
|
316
328
|
};
|
317
329
|
|
330
|
+
export type BasePayload<T> = {
|
331
|
+
payload: T;
|
332
|
+
};
|
318
333
|
|
319
|
-
type
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
334
|
+
export type NonceEnrichedPayload<T> = T & {
|
335
|
+
deadline: number;
|
336
|
+
signature: string;
|
337
|
+
};
|
338
|
+
|
339
|
+
export type NonceEnrichedSignedPayload<T> = {
|
340
|
+
signature: string;
|
341
|
+
signerAddress: string;
|
342
|
+
payload: NonceEnrichedPayload<T>;
|
343
|
+
};
|
344
|
+
|
345
|
+
type PerqToBeansSwapInfo = {
|
346
|
+
perqPrice: number;
|
347
|
+
price: number;
|
348
|
+
priceInFloat: number;
|
349
|
+
deadline: number;
|
350
|
+
signature: string;
|
351
|
+
};
|
352
|
+
|
353
|
+
type ProjectBacker = {
|
354
|
+
name: string;
|
355
|
+
image: string;
|
356
|
+
link: string;
|
357
|
+
};
|
358
|
+
|
359
|
+
type QLFastRedeem = {
|
360
|
+
assetsWithdrawn: {
|
361
|
+
asset: {
|
362
|
+
decimals: number;
|
363
|
+
id: string;
|
364
|
+
name: string;
|
365
|
+
symbol: string;
|
366
|
+
};
|
367
|
+
claimed: string;
|
368
|
+
id: string;
|
369
|
+
}[];
|
370
|
+
blockNumber: number;
|
371
|
+
id: string;
|
372
|
+
svtWithdrawn: string;
|
373
|
+
};
|
374
|
+
|
375
|
+
type Strategy = {
|
376
|
+
address: string;
|
377
|
+
lastDoHardWorkTime: number | null;
|
378
|
+
lastDoHardWorkBlock: number | null;
|
379
|
+
name: string;
|
380
|
+
assetGroupId: number;
|
381
|
+
apy: number;
|
382
|
+
};
|
383
|
+
|
384
|
+
interface StretchGoal {
|
385
|
+
threshhold: number;
|
386
|
+
amountOfTokens: number;
|
387
|
+
}
|
388
|
+
|
389
|
+
type SwapInfo = {
|
390
|
+
swapTarget: any;
|
391
|
+
token: string;
|
392
|
+
swapCallData: any;
|
325
393
|
};
|
326
394
|
|
395
|
+
type UpgradeLoyaltyCardPayload = {
|
396
|
+
index: number;
|
397
|
+
};
|
327
398
|
|
328
399
|
type UserRewards = {
|
329
|
-
|
400
|
+
// vaultAddress => pointsName => rewardsAmount
|
401
|
+
[vaultAddress: string]: { [rewardPointsName: string]: number };
|
330
402
|
};
|
331
403
|
|
332
|
-
type
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
404
|
+
type UserVaultBalance = {
|
405
|
+
hasWithdrawsToClaim: boolean;
|
406
|
+
userBalance: string;
|
407
|
+
pendingUserBalance: string;
|
408
|
+
pendingWithdrawalBalance: string;
|
409
|
+
claimableBalance: string;
|
410
|
+
};
|
337
411
|
|
338
|
-
type
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
412
|
+
type Vault = {
|
413
|
+
vaultName: string;
|
414
|
+
vaultAddress: string;
|
415
|
+
apy: number;
|
416
|
+
tvr: number;
|
417
|
+
protocols: string[];
|
418
|
+
depositToken: DepositToken;
|
419
|
+
type: VaultType;
|
420
|
+
rewards: VaultReward[];
|
421
|
+
rewardType: RewardType;
|
422
|
+
liveUntil: string;
|
423
|
+
liveFrom: string;
|
424
|
+
liveUntilFormatted: string;
|
425
|
+
hasPoolEnded: boolean;
|
426
|
+
boosters: NFTBoost[];
|
427
|
+
strategies: Strategy[];
|
428
|
+
tgePrice?: number;
|
429
|
+
maxAmountOfTokens?: number;
|
430
|
+
project: DeployedProject;
|
431
|
+
projectId: number;
|
432
|
+
coingeckoId?: string;
|
433
|
+
depositTokenId: string;
|
434
|
+
expectedTge?: string;
|
435
|
+
tokenPrice: number;
|
436
|
+
change24h: number;
|
437
|
+
volume24h: number;
|
438
|
+
projectFeatured: boolean;
|
439
|
+
avgTvl: string;
|
440
|
+
peakTvl: string;
|
441
|
+
amountOfDepositors: number;
|
442
|
+
boostedTvl: number;
|
443
|
+
projectVAPY?: number;
|
348
444
|
};
|
349
445
|
|
350
|
-
|
351
|
-
|
352
|
-
|
446
|
+
type VaultReward = {
|
447
|
+
id: number | undefined;
|
448
|
+
type: RewardType;
|
449
|
+
name: string;
|
450
|
+
symbol: string;
|
451
|
+
decimals: number;
|
452
|
+
tokenAddress: string;
|
453
|
+
monthlyEmissionRate: number;
|
454
|
+
blockNumber: number;
|
455
|
+
rewardRate: number;
|
456
|
+
timestamp: number;
|
457
|
+
endTime: number;
|
353
458
|
};
|
354
459
|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
460
|
+
type VaultStats = {
|
461
|
+
totalTVL: number;
|
462
|
+
totalUsers: number;
|
463
|
+
activeVaults: number;
|
464
|
+
};
|
359
465
|
|
360
|
-
|
361
|
-
White = 'White',
|
362
|
-
Ivory = 'Ivory',
|
363
|
-
Dune = 'Dune',
|
364
|
-
Amber = 'Amber',
|
365
|
-
Sienna = 'Sienna',
|
366
|
-
Umber = 'Umber',
|
367
|
-
Black = 'Black'
|
368
|
-
}
|
466
|
+
type VaultType = 'launch' | 'earn' | 'airdrop';
|
369
467
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
liveUntil: string,
|
377
|
-
coingeckoId?: string,
|
378
|
-
depositTokenId: 'WETH' | 'USDC' | 'DAI',
|
379
|
-
type: 'earn' | 'launch' | 'airdrop',
|
380
|
-
rewardType: 'points' | 'token' | 'pnode shards',
|
381
|
-
amountOfTokens?: number
|
382
|
-
vaultName: string,
|
383
|
-
protocols: string[],
|
384
|
-
apy: number,
|
385
|
-
tvr: number,
|
386
|
-
tokenPrice: number,
|
387
|
-
change24h: number,
|
388
|
-
volume24h: number,
|
389
|
-
rewards: CacheVaultRewards[]
|
390
|
-
strategies: Strategy[],
|
391
|
-
boosters: NFTBoost[],
|
392
|
-
depositToken: DepositToken
|
393
|
-
avgTvl: string
|
394
|
-
peakTvl: string
|
395
|
-
pendingDeposits: number;
|
396
|
-
currentlyDeposited: number;
|
397
|
-
pendingWithdraws: number;
|
398
|
-
claimable: number;
|
399
|
-
ethPrice: number;
|
400
|
-
tokenRewards: {[token_address: string]: Asset & { amount: number, rewardsPerHour: number }};
|
401
|
-
}
|
468
|
+
type VestingInfo = {
|
469
|
+
startTimestamp: string;
|
470
|
+
endTimestamp: string;
|
471
|
+
vested: string;
|
472
|
+
releasable: string;
|
473
|
+
releasableTotal: string;
|
402
474
|
};
|
475
|
+
|
476
|
+
type YelayVersion = 'v2' | 'lite';
|
403
477
|
```
|
404
478
|
|
405
479
|
# Abis
|
406
480
|
|
407
|
-
|
408
|
-
|
409
|
-
- WETH_TOKEN_ABI
|
410
|
-
|
411
|
-
- DRIP_TOKEN_ABI
|
481
|
+
- DRIP_SWAP_AND_RECYCLER_ABI
|
412
482
|
|
413
|
-
|
483
|
+
- WETH_TOKEN_ABI
|
414
484
|
|
415
|
-
|
485
|
+
- DRIP_TOKEN_ABI
|
416
486
|
|
487
|
+
- TOKEN_RECYCLER_ABI
|
417
488
|
|
489
|
+
- PERQ_VESTING_ABI
|