@dripfi/drip-sdk 1.4.28 → 1.4.29
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 +125 -23
- package/dist/PerqApi.d.ts +2 -0
- package/dist/PerqApi.js +33 -0
- package/dist/PerqSdk.d.ts +9 -2
- package/dist/PerqSdk.js +15 -1
- package/dist/abi/SlotBurnTokenAbi.json +130 -0
- package/dist/abi/index.d.ts +336 -0
- package/dist/abi/index.js +10 -4
- package/dist/abi/perq/BridgeMainnetPerqToSonicAbi.json +598 -0
- package/dist/abi/perq/BridgeSonicPerqToMainnetAbi.json +733 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +5 -0
- package/dist/contracts/{BasePerqContract.d.ts → BaseContract.d.ts} +1 -1
- package/dist/contracts/{BasePerqContract.js → BaseContract.js} +2 -2
- package/dist/contracts/BridgeMainnetPerqToSonicContract.d.ts +9 -0
- package/dist/contracts/BridgeMainnetPerqToSonicContract.js +48 -0
- package/dist/contracts/BridgeSonicPerqToMainnetContract.d.ts +9 -0
- package/dist/contracts/BridgeSonicPerqToMainnetContract.js +47 -0
- package/dist/contracts/SlotBurnTokenContract.d.ts +8 -0
- package/dist/contracts/SlotBurnTokenContract.js +26 -0
- package/dist/contracts/index.d.ts +9 -6
- package/dist/contracts/index.js +13 -7
- package/dist/contracts/{PerqSwapAndRecyclerContract.d.ts → perq/PerqSwapAndRecyclerContract.d.ts} +3 -3
- package/dist/contracts/{PerqSwapAndRecyclerContract.js → perq/PerqSwapAndRecyclerContract.js} +3 -3
- package/dist/contracts/{PerqTokenContract.d.ts → perq/PerqTokenContract.d.ts} +2 -2
- package/dist/contracts/{PerqTokenContract.js → perq/PerqTokenContract.js} +3 -3
- package/dist/contracts/{PerqTokenRecyclerContract.d.ts → perq/PerqTokenRecyclerContract.d.ts} +3 -3
- package/dist/contracts/{PerqTokenRecyclerContract.js → perq/PerqTokenRecyclerContract.js} +3 -3
- package/dist/contracts/{PerqVestingContract.d.ts → perq/PerqVestingContract.d.ts} +3 -3
- package/dist/contracts/{PerqVestingContract.js → perq/PerqVestingContract.js} +3 -3
- package/dist/subpackages/BridgePerqPackage.d.ts +36 -0
- package/dist/subpackages/BridgePerqPackage.js +205 -0
- package/dist/subpackages/LoyaltyCardsPackage.d.ts +6 -0
- package/dist/subpackages/LoyaltyCardsPackage.js +75 -0
- package/dist/subpackages/SiloPackage.d.ts +18 -0
- package/dist/subpackages/SiloPackage.js +112 -0
- package/dist/subpackages/SiloVaultOperations.d.ts +31 -0
- package/dist/subpackages/SiloVaultOperations.js +138 -0
- package/dist/subpackages/TokenUtilsPackage.d.ts +14 -0
- package/dist/subpackages/TokenUtilsPackage.js +31 -4
- package/dist/subpackages/VaultHandlerPackage.d.ts +54 -0
- package/dist/subpackages/VaultHandlerPackage.js +107 -0
- package/dist/subpackages/YelayVaultOperations.d.ts +13 -0
- package/dist/subpackages/YelayVaultOperations.js +164 -0
- package/dist/types/BridgePerq.d.ts +14 -0
- package/dist/types/BridgePerq.js +2 -0
- package/dist/types/DeployedProject.d.ts +1 -0
- package/dist/types/LoyaltyCard.d.ts +2 -0
- package/dist/types/PerqConfig.d.ts +3 -0
- package/dist/types/PerqConfig.js +6 -0
- package/dist/types/SdkType.d.ts +2 -0
- package/dist/types/SdkType.js +2 -0
- package/dist/types/SlotMachineSpinCost.d.ts +7 -0
- package/dist/types/SlotMachineSpinCost.js +2 -0
- package/dist/types/VaultData.d.ts +2 -0
- package/dist/types/VaultOperationParams.d.ts +12 -0
- package/dist/types/VaultOperationParams.js +2 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +2 -1
- /package/dist/abi/{PerqSwapAndRecyclerAbi.json → perq/PerqSwapAndRecyclerAbi.json} +0 -0
- /package/dist/abi/{PerqTokenAbi.json → perq/PerqTokenAbi.json} +0 -0
- /package/dist/abi/{PerqVestingAbi.json → perq/PerqVestingAbi.json} +0 -0
- /package/dist/abi/{TokenRecyclerAbi.json → perq/TokenRecyclerAbi.json} +0 -0
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ The Drip SDK is a TypeScript library designed to interact with the Perq protocol
|
|
|
15
15
|
- [Vesting](#vesting)
|
|
16
16
|
- [Recycler](#recycler)
|
|
17
17
|
- [Sign Handler](#sign-handler)
|
|
18
|
+
- [Silo](#silo)
|
|
19
|
+
- [Vault Handler](#vault-handler)
|
|
18
20
|
- [Examples](#examples)
|
|
19
21
|
- [Types](#types)
|
|
20
22
|
- [Abis](#abis)
|
|
@@ -52,6 +54,35 @@ const perqSdk = new PerqSdk(perqConfig, perqSupportedChainId, provider?: ethers.
|
|
|
52
54
|
|
|
53
55
|
## Modules
|
|
54
56
|
|
|
57
|
+
### Automatic Deposit Type Detection
|
|
58
|
+
|
|
59
|
+
The SDK automatically determines the deposit type based on the provided parameters:
|
|
60
|
+
|
|
61
|
+
- **Direct Deposit**: When `sourceTokenSymbol` equals `vaultTokenSymbol`
|
|
62
|
+
- **Wrap Deposit**: When `sourceTokenSymbol` is "ETH" / "S" or any other native token
|
|
63
|
+
- **Swap Deposit**: When `sourceTokenSymbol` differs from `vaultTokenSymbol` only possible on certain `sdkType` vaults
|
|
64
|
+
|
|
65
|
+
### Supported SDK Types
|
|
66
|
+
|
|
67
|
+
- **Yelay**: Supports direct deposits, ETH deposits, and swap deposits
|
|
68
|
+
- **Silo**: Supports standard ERC20 deposits and withdrawals
|
|
69
|
+
|
|
70
|
+
### Vault Handler
|
|
71
|
+
|
|
72
|
+
Access vault methods through `sdk.vault`:
|
|
73
|
+
|
|
74
|
+
| Method | Description |
|
|
75
|
+
| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
76
|
+
| `getAllowance(params: VaultOperationParams): Promise<boolean>` | Checks if the user's allowance is sufficient for the `depositAmount` |
|
|
77
|
+
| `approveAllowance(params: VaultOperationParams): Promise<string>` | Approves the allowance for the `depositAmount` for the selected Vault |
|
|
78
|
+
| `deposit(params: VaultOperationParams): Promise<string>` | Deposits the `depositAmount` into the selected `vault` |
|
|
79
|
+
| `withdraw(params: VaultOperationParams): Promise<string>` | Withdraws the specified amount from the selected vault |
|
|
80
|
+
| `getBalance(vaultAddress: string, tokenAddress?: string, onChainProjectId?: number): Promise<string>` | Gets the user's balance for the specified vault |
|
|
81
|
+
|
|
82
|
+
## Legacy Methods
|
|
83
|
+
|
|
84
|
+
For backward compatibility, the original methods are still available:
|
|
85
|
+
|
|
55
86
|
### Core SDK
|
|
56
87
|
|
|
57
88
|
Core methods available directly on the SDK instance:
|
|
@@ -154,16 +185,15 @@ Access recycler methods through `sdk.recycler`:
|
|
|
154
185
|
|
|
155
186
|
Access token utils methods through `sdk.tokenUtils`:
|
|
156
187
|
|
|
157
|
-
| Method
|
|
158
|
-
|
|
159
|
-
|
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `getPerqTokenContractAddress(): string` | Returns the contract address of the Perq token. |
|
|
188
|
+
| Method | Description |
|
|
189
|
+
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
190
|
+
| `getTokenPrice(tokenName: string): Promise<number>` | Fetches the current price of a given token. "perq", "weth", "eth" and "wbtc" are supported |
|
|
191
|
+
| `getAllowance(tokenAddress: string, spender: string): Promise<string>` | Retrieves the current allowance for a token. |
|
|
192
|
+
| `approveAllowance(tokenAddress: string, amount: string, spenderAddress: string): Promise<string>` | Approves a specific amount of tokens for use by a spender. |
|
|
193
|
+
| `transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string>` | Transfers a specified amount of ERC20 tokens to a receiver. |
|
|
194
|
+
| `wrapEther(amount: string, tokenAddress: string): Promise<string>` | Wraps a specified amount of Ether into a WETH token. |
|
|
195
|
+
| `getERC20TokenAllowance(spender: string, tokenAddress: string): Promise<BigNumber>` | Retrieves the allowance for a specific ERC20 token. |
|
|
196
|
+
| `getPerqTokenContractAddress(): string` | Returns the contract address of the Perq token. |
|
|
167
197
|
|
|
168
198
|
### Sign Handler
|
|
169
199
|
|
|
@@ -173,6 +203,20 @@ Access signing methods through `sdk.signHandler`:
|
|
|
173
203
|
| -------------------------------------------------------------------- | -------------------------------------- |
|
|
174
204
|
| `signPayload<T>(payload: T): Promise<NonceEnrichedSignedPayload<T>>` | Signs a payload with nonce enrichment. |
|
|
175
205
|
|
|
206
|
+
### Silo
|
|
207
|
+
|
|
208
|
+
Access silo methods through `sdk.silo`:
|
|
209
|
+
|
|
210
|
+
| Method | Description |
|
|
211
|
+
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
212
|
+
| `deposit(assetAmount: string, vaultAddress: string): Promise<string \| undefined>` | Deposits into a Silo Vault. |
|
|
213
|
+
| `withdraw(assetAmount: string, vaultAddress: string): Promise<string \| undefined>` | Withdraws from a Silo Vault. Recommended for partial withdrawals. |
|
|
214
|
+
| `redeem(sharesAmount: string, vaultAddress: string): Promise<string \| undefined>` | Withdraws from a Silo Vault. Recommended for full withdraws. |
|
|
215
|
+
| `getBalanceInShares(vaultAddress: string): Promise<BigNumber>` | Get the users balance in Shares. |
|
|
216
|
+
| `getBalanceInAssets(vaultAddress: string): Promise<BigNumber>` | Get the users balance in the vaults currency/asset. |
|
|
217
|
+
| `getTotalSupply(vaultAddress: string): Promise<BigNumber>` | Retrieves the total amounts of shares in the Vault. |
|
|
218
|
+
| `getTotalAssets(vaultAddress: string): string` | Returns the total balance in the vaults currency/asset. |
|
|
219
|
+
|
|
176
220
|
## Examples
|
|
177
221
|
|
|
178
222
|
### `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>`
|
|
@@ -282,6 +326,38 @@ const txHash = await lite.withdraw(
|
|
|
282
326
|
);
|
|
283
327
|
```
|
|
284
328
|
|
|
329
|
+
### `checkMainnetToSonicBridgeApproval(amount: string): Promise<boolean>`
|
|
330
|
+
|
|
331
|
+
I want to check if the User approved the bridge contract to bridge 10 PERQ from MAINNET to SONIC
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
const hasApprovedAmount = await dripSdk.bridge.checkMainnetToSonicBridgeApproval('10');
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### `approveMainnetToSonicBridge(amount: string): Promise<string>`
|
|
338
|
+
|
|
339
|
+
I want to approve to bridge 10 PERQ from MAINNET to SONIC
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
const txHash = await dripSdk.bridge.approveMainnetToSonicBridge('10');
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### `bridgeMainnetToSonic(amount: string): Promise<string>`
|
|
346
|
+
|
|
347
|
+
I want to bridge 10 PERQ from MAINNET to SONIC
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
const txHash = await dripSdk.bridge.bridgeMainnetToSonic('10');
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### `bridgeSonicToMainnet(amount: string): Promise<string>`
|
|
354
|
+
|
|
355
|
+
I want to bridge 10 PERQ from SONIC to MAINNET
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
const txHash = await dripSdk.bridge.bridgeSonicToMainnet('10');
|
|
359
|
+
```
|
|
360
|
+
|
|
285
361
|
## Types
|
|
286
362
|
|
|
287
363
|
```typescript
|
|
@@ -370,6 +446,8 @@ type DepositToken = {
|
|
|
370
446
|
tokenAddress: string;
|
|
371
447
|
};
|
|
372
448
|
|
|
449
|
+
type DepositType = 'direct' | 'swap' | 'wrap';
|
|
450
|
+
|
|
373
451
|
enum ELoyaltyCardTier {
|
|
374
452
|
White = 'White',
|
|
375
453
|
Ivory = 'Ivory',
|
|
@@ -380,6 +458,14 @@ enum ELoyaltyCardTier {
|
|
|
380
458
|
Black = 'Black',
|
|
381
459
|
}
|
|
382
460
|
|
|
461
|
+
interface VaultOperations {
|
|
462
|
+
getAllowance(params: VaultOperationParams): Promise<boolean>;
|
|
463
|
+
approveAllowance(params: VaultOperationParams): Promise<string>;
|
|
464
|
+
deposit(params: VaultOperationParams): Promise<string>;
|
|
465
|
+
withdraw(params: WithdrawParams): Promise<string>;
|
|
466
|
+
getBalance(vaultAddress: string, tokenAddress?: string, onChainProjectId?: number): Promise<string>;
|
|
467
|
+
}
|
|
468
|
+
|
|
383
469
|
type LoyaltyCard = {
|
|
384
470
|
id: string;
|
|
385
471
|
tier: ELoyaltyCardTier;
|
|
@@ -434,15 +520,15 @@ type NonceEnrichedSignedPayload<T> = {
|
|
|
434
520
|
|
|
435
521
|
type PerqConfig = {
|
|
436
522
|
route: string;
|
|
437
|
-
yelayLiteSdkConfig: sdkConfig;
|
|
438
523
|
perqTokenAddress: string;
|
|
439
524
|
perqTokenRecyclerAddress: string;
|
|
440
525
|
perqSwapAndRecyclerAddress: string;
|
|
441
526
|
perqVestingAddress: string;
|
|
442
527
|
swapAndDepositContractAddress: string;
|
|
443
|
-
smartVaultManagerContractAddress: string;
|
|
444
528
|
ethereumSwapperAddress: string;
|
|
445
|
-
|
|
529
|
+
smartVaultManagerContractAddress: string,
|
|
530
|
+
bridgeMainnetPerqToSonicAddress: string;
|
|
531
|
+
bridgeSonicPerqToMainnetAddress: string;
|
|
446
532
|
};
|
|
447
533
|
|
|
448
534
|
type PerqToBeansSwapInfo = {
|
|
@@ -475,6 +561,8 @@ type QLFastRedeem = {
|
|
|
475
561
|
svtWithdrawn: string;
|
|
476
562
|
};
|
|
477
563
|
|
|
564
|
+
type SdkType = 'yelay' | 'silo';
|
|
565
|
+
|
|
478
566
|
type SpecialEditionLoyaltyCard = {
|
|
479
567
|
id: string;
|
|
480
568
|
name: string;
|
|
@@ -568,6 +656,7 @@ type VaultData = {
|
|
|
568
656
|
stretchGoals: StretchGoal[];
|
|
569
657
|
rewards: VaultReward[];
|
|
570
658
|
rewardTooltipName: string;
|
|
659
|
+
sdkType: SdkType;
|
|
571
660
|
};
|
|
572
661
|
|
|
573
662
|
type VaultReward = {
|
|
@@ -592,6 +681,26 @@ type VaultStats = {
|
|
|
592
681
|
|
|
593
682
|
type VaultType = 'launch' | 'earn' | 'airdrop';
|
|
594
683
|
|
|
684
|
+
interface WithdrawParams {
|
|
685
|
+
amount: string;
|
|
686
|
+
sdkType: SdkType;
|
|
687
|
+
tokenAddress: string;
|
|
688
|
+
vaultAddress: string;
|
|
689
|
+
// Optional parameters that may be needed for specific SDK implementations
|
|
690
|
+
onChainProjectId?: number; // needed for yelay SDK
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
interface VaultOperationParams {
|
|
694
|
+
sourceTokenAddress: string;
|
|
695
|
+
vaultTokenAddress: string;
|
|
696
|
+
vaultAddress: string;
|
|
697
|
+
amount: string;
|
|
698
|
+
sdkType: SdkType;
|
|
699
|
+
onChainProjectId?: number;
|
|
700
|
+
sourceTokenSymbol?: string;
|
|
701
|
+
vaultTokenSymbol?: string;
|
|
702
|
+
}
|
|
703
|
+
|
|
595
704
|
type VestingInfo = {
|
|
596
705
|
startTimestamp: string;
|
|
597
706
|
endTimestamp: string;
|
|
@@ -655,12 +764,6 @@ type DetailedProjectData = ReducedProjectData & {
|
|
|
655
764
|
|
|
656
765
|
type RewardType = 'token' | 'points';
|
|
657
766
|
|
|
658
|
-
type SDKConfig = {
|
|
659
|
-
chainId: number;
|
|
660
|
-
rpcUrl: string;
|
|
661
|
-
// ... other SDK configuration
|
|
662
|
-
};
|
|
663
|
-
|
|
664
767
|
const BASE_CHAIN_ID = 8453;
|
|
665
768
|
const ETHEREUM_CHAIN_ID = 1;
|
|
666
769
|
const ETHEREUM_SEPOLIA_CHAIN_ID = 11155111;
|
|
@@ -692,16 +795,15 @@ type OverallStats = {
|
|
|
692
795
|
totalUsers: number;
|
|
693
796
|
};
|
|
694
797
|
|
|
798
|
+
|
|
695
799
|
```
|
|
696
800
|
|
|
697
801
|
## Abis
|
|
698
802
|
|
|
699
803
|
- PERQ_SWAP_AND_RECYCLER_ABI
|
|
700
|
-
|
|
701
804
|
- WETH_TOKEN_ABI
|
|
702
|
-
|
|
703
805
|
- PERQ_TOKEN_ABI
|
|
704
|
-
|
|
705
806
|
- TOKEN_RECYCLER_ABI
|
|
706
|
-
|
|
707
807
|
- PERQ_VESTING_ABI
|
|
808
|
+
- BRIDGE_SONIC_PERQ_TO_MAINNET_ABI
|
|
809
|
+
- BRIDGE_MAINNET_PERQ_TO_SONIC_ABI
|
package/dist/PerqApi.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export default class PerqApi {
|
|
|
27
27
|
fetchAllLoyaltyCards(): Promise<LoyaltyCard[]>;
|
|
28
28
|
fetchAllSpecialEditionLoyaltyCards(): Promise<SpecialEditionLoyaltyCard[]>;
|
|
29
29
|
fetchOwnedLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
|
|
30
|
+
fetchNextLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
|
|
30
31
|
fetchOwnedSpecialEditionLoyaltyCards(walletAddress: string): Promise<SpecialEditionLoyaltyCard[]>;
|
|
31
32
|
fetchBeansBalance(walletAddress: string): Promise<BeansBalance>;
|
|
32
33
|
upgradeLoyaltyCard(signedPayload: NonceEnrichedSignedPayload<UpgradeLoyaltyCardPayload>): Promise<LoyaltyCard>;
|
|
@@ -42,4 +43,5 @@ export default class PerqApi {
|
|
|
42
43
|
fetchEarnings(userAddress: string, projectName: string): Promise<Earnings>;
|
|
43
44
|
fetchMigrationOptions(vaultAddress: string, onChainProjectId: number): Promise<MigrationOption[]>;
|
|
44
45
|
fetchHistoricalTvl(projectName: string): Promise<ProjectHistoricalTvl>;
|
|
46
|
+
updateSlotMachineReadNow(): Promise<void>;
|
|
45
47
|
}
|
package/dist/PerqApi.js
CHANGED
|
@@ -185,6 +185,8 @@ class PerqApi {
|
|
|
185
185
|
level: card.level,
|
|
186
186
|
cost: parseFloat(ethers_1.ethers.utils.formatUnits(card.cost.toString(), PERQ_TOKEN_DECIMALS)),
|
|
187
187
|
boost: card.boost,
|
|
188
|
+
chanceToUpgrade: card.chanceToUpgrade,
|
|
189
|
+
minBurnPerSpinUsd: card.minBurnPerSpinUsd,
|
|
188
190
|
}));
|
|
189
191
|
}
|
|
190
192
|
else {
|
|
@@ -214,6 +216,29 @@ class PerqApi {
|
|
|
214
216
|
level: data.level,
|
|
215
217
|
cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
|
|
216
218
|
boost: data.boost,
|
|
219
|
+
chanceToUpgrade: data.chanceToUpgrade,
|
|
220
|
+
minBurnPerSpinUsd: data.minBurnPerSpinUsd,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
throw Error(`${await res.text()}`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async fetchNextLoyaltyCard(walletAddress) {
|
|
228
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/loyaltyCards/next`);
|
|
229
|
+
if (res.status === 204) {
|
|
230
|
+
return {};
|
|
231
|
+
}
|
|
232
|
+
if (res.ok) {
|
|
233
|
+
const data = await res.json();
|
|
234
|
+
return {
|
|
235
|
+
id: data.id,
|
|
236
|
+
tier: data.tier,
|
|
237
|
+
level: data.level,
|
|
238
|
+
cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
|
|
239
|
+
boost: data.boost,
|
|
240
|
+
chanceToUpgrade: data.chanceToUpgrade,
|
|
241
|
+
minBurnPerSpinUsd: data.minBurnPerSpinUsd,
|
|
217
242
|
};
|
|
218
243
|
}
|
|
219
244
|
else {
|
|
@@ -261,6 +286,8 @@ class PerqApi {
|
|
|
261
286
|
level: data.level,
|
|
262
287
|
cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
|
|
263
288
|
boost: data.boost,
|
|
289
|
+
chanceToUpgrade: data.chanceToUpgrade,
|
|
290
|
+
minBurnPerSpinUsd: data.minBurnPerSpinUsd,
|
|
264
291
|
};
|
|
265
292
|
}
|
|
266
293
|
else {
|
|
@@ -423,5 +450,11 @@ class PerqApi {
|
|
|
423
450
|
throw Error(`${await res.text()}`);
|
|
424
451
|
}
|
|
425
452
|
}
|
|
453
|
+
async updateSlotMachineReadNow() {
|
|
454
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/slotmachine/readnow`, { method: 'PUT' });
|
|
455
|
+
if (!res.ok) {
|
|
456
|
+
throw Error(`${await res.text()}`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
426
459
|
}
|
|
427
460
|
exports.default = PerqApi;
|
package/dist/PerqSdk.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Signer, ethers } from 'ethers';
|
|
2
2
|
import { PerqConfig } from './types';
|
|
3
3
|
import PerqApi from './PerqApi';
|
|
4
|
-
import { PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqVestingContract } from './contracts';
|
|
4
|
+
import { PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqVestingContract, SlotBurnTokenContract } from './contracts';
|
|
5
5
|
import VestingPackage from './subpackages/VestingPackage';
|
|
6
|
+
import BridgePerqPackage from './subpackages/BridgePerqPackage';
|
|
6
7
|
import LitePackage from './subpackages/LitePackage';
|
|
7
8
|
import RecyclerPackage from './subpackages/RecyclerPackage';
|
|
8
9
|
import LoyaltyCardsPackage from './subpackages/LoyaltyCardsPackage';
|
|
@@ -12,22 +13,28 @@ import UserPackage from './subpackages/UserPackage';
|
|
|
12
13
|
import SignHandlerPackage from './subpackages/SignHandlerPackage';
|
|
13
14
|
import PoolsPackage from './subpackages/PoolsPackage';
|
|
14
15
|
import { PerqSupportedChainId } from './types/PerqConfig';
|
|
16
|
+
import SiloPackage from './subpackages/SiloPackage';
|
|
17
|
+
import VaultHandler from './subpackages/VaultHandlerPackage';
|
|
15
18
|
export default class PerqSdk {
|
|
16
19
|
perqApi: PerqApi;
|
|
17
20
|
signer?: Signer;
|
|
18
21
|
lite: LitePackage;
|
|
19
22
|
vesting: VestingPackage;
|
|
23
|
+
bridge: BridgePerqPackage;
|
|
20
24
|
recycler: RecyclerPackage;
|
|
21
25
|
loyaltyCards: LoyaltyCardsPackage;
|
|
22
26
|
tokenUtils: TokenUtilsPackage;
|
|
23
27
|
user: UserPackage;
|
|
24
28
|
signHandler: SignHandlerPackage;
|
|
25
29
|
pools: PoolsPackage;
|
|
30
|
+
vault: VaultHandler;
|
|
26
31
|
perqConfig: PerqConfig;
|
|
27
|
-
yelayLiteSdk?: YelayLiteSdk;
|
|
28
32
|
perqVestingContract: PerqVestingContract;
|
|
29
33
|
perqTokenRecyclerContract: PerqTokenRecyclerContract;
|
|
30
34
|
perqSwapAndRecyclerContract: PerqSwapAndRecyclerContract;
|
|
35
|
+
slotBurnTokenContract: SlotBurnTokenContract;
|
|
36
|
+
yelayLiteSdk?: YelayLiteSdk;
|
|
37
|
+
siloPackage?: SiloPackage;
|
|
31
38
|
constructor(perqConfig: PerqConfig, chainId: PerqSupportedChainId, provider?: ethers.providers.JsonRpcProvider);
|
|
32
39
|
updateSigner(newSigner: Signer, chainId: PerqSupportedChainId): Promise<void>;
|
|
33
40
|
}
|
package/dist/PerqSdk.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const PerqApi_1 = __importDefault(require("./PerqApi"));
|
|
7
7
|
const contracts_1 = require("./contracts");
|
|
8
8
|
const VestingPackage_1 = __importDefault(require("./subpackages/VestingPackage"));
|
|
9
|
+
const BridgePerqPackage_1 = __importDefault(require("./subpackages/BridgePerqPackage"));
|
|
9
10
|
const LitePackage_1 = __importDefault(require("./subpackages/LitePackage"));
|
|
10
11
|
const RecyclerPackage_1 = __importDefault(require("./subpackages/RecyclerPackage"));
|
|
11
12
|
const LoyaltyCardsPackage_1 = __importDefault(require("./subpackages/LoyaltyCardsPackage"));
|
|
@@ -14,30 +15,38 @@ const TokenUtilsPackage_1 = __importDefault(require("./subpackages/TokenUtilsPac
|
|
|
14
15
|
const UserPackage_1 = __importDefault(require("./subpackages/UserPackage"));
|
|
15
16
|
const SignHandlerPackage_1 = __importDefault(require("./subpackages/SignHandlerPackage"));
|
|
16
17
|
const PoolsPackage_1 = __importDefault(require("./subpackages/PoolsPackage"));
|
|
18
|
+
const SiloPackage_1 = __importDefault(require("./subpackages/SiloPackage"));
|
|
19
|
+
const VaultHandlerPackage_1 = __importDefault(require("./subpackages/VaultHandlerPackage"));
|
|
17
20
|
class PerqSdk {
|
|
18
21
|
perqApi;
|
|
19
22
|
signer;
|
|
20
23
|
lite;
|
|
21
24
|
vesting;
|
|
25
|
+
bridge;
|
|
22
26
|
recycler;
|
|
23
27
|
loyaltyCards;
|
|
24
28
|
tokenUtils;
|
|
25
29
|
user;
|
|
26
30
|
signHandler;
|
|
27
31
|
pools;
|
|
32
|
+
vault;
|
|
28
33
|
perqConfig;
|
|
29
|
-
yelayLiteSdk;
|
|
30
34
|
perqVestingContract;
|
|
31
35
|
perqTokenRecyclerContract;
|
|
32
36
|
perqSwapAndRecyclerContract;
|
|
37
|
+
slotBurnTokenContract;
|
|
38
|
+
yelayLiteSdk;
|
|
39
|
+
siloPackage;
|
|
33
40
|
constructor(perqConfig, chainId, provider) {
|
|
34
41
|
this.perqConfig = perqConfig;
|
|
35
42
|
const newSigner = provider?.getSigner();
|
|
36
43
|
if (newSigner) {
|
|
37
44
|
this.signer = newSigner;
|
|
38
45
|
this.yelayLiteSdk = new sdk_1.YelayLiteSdk(this.signer, chainId, false);
|
|
46
|
+
this.siloPackage = new SiloPackage_1.default(newSigner);
|
|
39
47
|
}
|
|
40
48
|
this.vesting = new VestingPackage_1.default(this);
|
|
49
|
+
this.bridge = new BridgePerqPackage_1.default(this);
|
|
41
50
|
this.lite = new LitePackage_1.default(this);
|
|
42
51
|
this.recycler = new RecyclerPackage_1.default(this);
|
|
43
52
|
this.loyaltyCards = new LoyaltyCardsPackage_1.default(this);
|
|
@@ -45,10 +54,12 @@ class PerqSdk {
|
|
|
45
54
|
this.user = new UserPackage_1.default(this);
|
|
46
55
|
this.signHandler = new SignHandlerPackage_1.default(this);
|
|
47
56
|
this.pools = new PoolsPackage_1.default(this);
|
|
57
|
+
this.vault = new VaultHandlerPackage_1.default(this);
|
|
48
58
|
this.perqApi = new PerqApi_1.default(this);
|
|
49
59
|
this.perqVestingContract = new contracts_1.PerqVestingContract(this);
|
|
50
60
|
this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(this);
|
|
51
61
|
this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(this);
|
|
62
|
+
this.slotBurnTokenContract = new contracts_1.SlotBurnTokenContract(this);
|
|
52
63
|
}
|
|
53
64
|
async updateSigner(newSigner, chainId) {
|
|
54
65
|
this.signer = newSigner;
|
|
@@ -56,6 +67,9 @@ class PerqSdk {
|
|
|
56
67
|
this.perqVestingContract = new contracts_1.PerqVestingContract(this);
|
|
57
68
|
this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(this);
|
|
58
69
|
this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(this);
|
|
70
|
+
this.slotBurnTokenContract = new contracts_1.SlotBurnTokenContract(this);
|
|
71
|
+
this.bridge = new BridgePerqPackage_1.default(this);
|
|
72
|
+
this.siloPackage = new SiloPackage_1.default(newSigner);
|
|
59
73
|
}
|
|
60
74
|
}
|
|
61
75
|
exports.default = PerqSdk;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{ "internalType": "address", "name": "admin", "type": "address" },
|
|
5
|
+
{ "internalType": "contract IERC20[]", "name": "whitelistedTokens", "type": "address[]" }
|
|
6
|
+
],
|
|
7
|
+
"stateMutability": "nonpayable",
|
|
8
|
+
"type": "constructor"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"inputs": [{ "internalType": "address", "name": "owner", "type": "address" }],
|
|
12
|
+
"name": "OwnableInvalidOwner",
|
|
13
|
+
"type": "error"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
|
|
17
|
+
"name": "OwnableUnauthorizedAccount",
|
|
18
|
+
"type": "error"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"inputs": [{ "internalType": "address", "name": "token", "type": "address" }],
|
|
22
|
+
"name": "SafeERC20FailedOperation",
|
|
23
|
+
"type": "error"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"anonymous": false,
|
|
27
|
+
"inputs": [{ "indexed": false, "internalType": "contract IERC20[]", "name": "tokens", "type": "address[]" }],
|
|
28
|
+
"name": "AddedTokens",
|
|
29
|
+
"type": "event"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"anonymous": false,
|
|
33
|
+
"inputs": [
|
|
34
|
+
{ "indexed": true, "internalType": "contract IERC20", "name": "token", "type": "address" },
|
|
35
|
+
{ "indexed": true, "internalType": "address", "name": "depositor", "type": "address" },
|
|
36
|
+
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
|
|
37
|
+
],
|
|
38
|
+
"name": "Deposit",
|
|
39
|
+
"type": "event"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"anonymous": false,
|
|
43
|
+
"inputs": [
|
|
44
|
+
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
|
|
45
|
+
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
|
|
46
|
+
],
|
|
47
|
+
"name": "OwnershipTransferred",
|
|
48
|
+
"type": "event"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"anonymous": false,
|
|
52
|
+
"inputs": [{ "indexed": false, "internalType": "contract IERC20[]", "name": "tokens", "type": "address[]" }],
|
|
53
|
+
"name": "RemovedTokens",
|
|
54
|
+
"type": "event"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"anonymous": false,
|
|
58
|
+
"inputs": [
|
|
59
|
+
{ "indexed": true, "internalType": "contract IERC20", "name": "token", "type": "address" },
|
|
60
|
+
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" },
|
|
61
|
+
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
|
|
62
|
+
],
|
|
63
|
+
"name": "Withdraw",
|
|
64
|
+
"type": "event"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"inputs": [],
|
|
68
|
+
"name": "WRAPPED_SONIC",
|
|
69
|
+
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
|
|
70
|
+
"stateMutability": "view",
|
|
71
|
+
"type": "function"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"inputs": [{ "internalType": "contract IERC20[]", "name": "tokens", "type": "address[]" }],
|
|
75
|
+
"name": "addTokens",
|
|
76
|
+
"outputs": [],
|
|
77
|
+
"stateMutability": "nonpayable",
|
|
78
|
+
"type": "function"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"inputs": [
|
|
82
|
+
{ "internalType": "contract IERC20", "name": "token", "type": "address" },
|
|
83
|
+
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
|
84
|
+
],
|
|
85
|
+
"name": "deposit",
|
|
86
|
+
"outputs": [],
|
|
87
|
+
"stateMutability": "nonpayable",
|
|
88
|
+
"type": "function"
|
|
89
|
+
},
|
|
90
|
+
{ "inputs": [], "name": "depositNative", "outputs": [], "stateMutability": "payable", "type": "function" },
|
|
91
|
+
{
|
|
92
|
+
"inputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
|
|
93
|
+
"name": "isTokenWhitelisted",
|
|
94
|
+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
|
95
|
+
"stateMutability": "view",
|
|
96
|
+
"type": "function"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"inputs": [],
|
|
100
|
+
"name": "owner",
|
|
101
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
102
|
+
"stateMutability": "view",
|
|
103
|
+
"type": "function"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"inputs": [{ "internalType": "contract IERC20[]", "name": "tokens", "type": "address[]" }],
|
|
107
|
+
"name": "removeTokens",
|
|
108
|
+
"outputs": [],
|
|
109
|
+
"stateMutability": "nonpayable",
|
|
110
|
+
"type": "function"
|
|
111
|
+
},
|
|
112
|
+
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
|
|
113
|
+
{
|
|
114
|
+
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
|
|
115
|
+
"name": "transferOwnership",
|
|
116
|
+
"outputs": [],
|
|
117
|
+
"stateMutability": "nonpayable",
|
|
118
|
+
"type": "function"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"inputs": [
|
|
122
|
+
{ "internalType": "contract IERC20", "name": "token", "type": "address" },
|
|
123
|
+
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
|
124
|
+
],
|
|
125
|
+
"name": "withdraw",
|
|
126
|
+
"outputs": [],
|
|
127
|
+
"stateMutability": "nonpayable",
|
|
128
|
+
"type": "function"
|
|
129
|
+
}
|
|
130
|
+
]
|