@dripfi/drip-sdk 1.4.34 → 1.4.35-beta.2
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/package.json +11 -12
- package/dist/PerqApi.d.ts +0 -49
- package/dist/PerqApi.js +0 -475
- package/dist/PerqSdk.d.ts +0 -40
- package/dist/PerqSdk.js +0 -75
- package/dist/abi/ERC20.json +0 -222
- package/dist/abi/SlotBurnTokenAbi.json +0 -130
- package/dist/abi/WethTokenAbi.json +0 -25
- package/dist/abi/index.d.ts +0 -411
- package/dist/abi/index.js +0 -23
- package/dist/abi/perq/BridgeMainnetPerqToSonicAbi.json +0 -598
- package/dist/abi/perq/BridgeSonicPerqToMainnetAbi.json +0 -733
- package/dist/abi/perq/PerqSwapAndRecyclerAbi.json +0 -95
- package/dist/abi/perq/PerqTokenAbi.json +0 -48
- package/dist/abi/perq/PerqVestingAbi.json +0 -126
- package/dist/abi/perq/TokenRecyclerAbi.json +0 -41
- package/dist/constants.d.ts +0 -2
- package/dist/constants.js +0 -5
- package/dist/contracts/BaseContract.d.ts +0 -7
- package/dist/contracts/BaseContract.js +0 -16
- package/dist/contracts/BridgeMainnetPerqToSonicContract.d.ts +0 -9
- package/dist/contracts/BridgeMainnetPerqToSonicContract.js +0 -48
- package/dist/contracts/BridgeSonicPerqToMainnetContract.d.ts +0 -9
- package/dist/contracts/BridgeSonicPerqToMainnetContract.js +0 -47
- package/dist/contracts/ERC20TokenContract.d.ts +0 -10
- package/dist/contracts/ERC20TokenContract.js +0 -34
- package/dist/contracts/SlotBurnTokenContract.d.ts +0 -8
- package/dist/contracts/SlotBurnTokenContract.js +0 -26
- package/dist/contracts/index.d.ts +0 -9
- package/dist/contracts/index.js +0 -22
- package/dist/contracts/perq/PerqSwapAndRecyclerContract.d.ts +0 -8
- package/dist/contracts/perq/PerqSwapAndRecyclerContract.js +0 -28
- package/dist/contracts/perq/PerqTokenContract.d.ts +0 -7
- package/dist/contracts/perq/PerqTokenContract.js +0 -26
- package/dist/contracts/perq/PerqTokenRecyclerContract.d.ts +0 -7
- package/dist/contracts/perq/PerqTokenRecyclerContract.js +0 -20
- package/dist/contracts/perq/PerqVestingContract.d.ts +0 -13
- package/dist/contracts/perq/PerqVestingContract.js +0 -56
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -28
- package/dist/subpackages/BridgePerqPackage.d.ts +0 -36
- package/dist/subpackages/BridgePerqPackage.js +0 -205
- package/dist/subpackages/LitePackage.d.ts +0 -19
- package/dist/subpackages/LitePackage.js +0 -106
- package/dist/subpackages/LoyaltyCardsPackage.d.ts +0 -21
- package/dist/subpackages/LoyaltyCardsPackage.js +0 -123
- package/dist/subpackages/PoolsPackage.d.ts +0 -21
- package/dist/subpackages/PoolsPackage.js +0 -58
- package/dist/subpackages/RecyclerPackage.d.ts +0 -13
- package/dist/subpackages/RecyclerPackage.js +0 -87
- package/dist/subpackages/SignHandlerPackage.d.ts +0 -8
- package/dist/subpackages/SignHandlerPackage.js +0 -33
- package/dist/subpackages/SiloPackage.d.ts +0 -18
- package/dist/subpackages/SiloPackage.js +0 -112
- package/dist/subpackages/SiloVaultOperations.d.ts +0 -31
- package/dist/subpackages/SiloVaultOperations.js +0 -119
- package/dist/subpackages/TokenUtilsPackage.d.ts +0 -27
- package/dist/subpackages/TokenUtilsPackage.js +0 -93
- package/dist/subpackages/UserPackage.d.ts +0 -11
- package/dist/subpackages/UserPackage.js +0 -43
- package/dist/subpackages/VaultHandlerPackage.d.ts +0 -54
- package/dist/subpackages/VaultHandlerPackage.js +0 -107
- package/dist/subpackages/VestingPackage.d.ts +0 -14
- package/dist/subpackages/VestingPackage.js +0 -112
- package/dist/subpackages/YelayVaultOperations.d.ts +0 -13
- package/dist/subpackages/YelayVaultOperations.js +0 -107
- package/dist/types/Asset.d.ts +0 -5
- package/dist/types/Asset.js +0 -2
- package/dist/types/BeanEntry.d.ts +0 -12
- package/dist/types/BeanEntry.js +0 -2
- package/dist/types/BeansBalance.d.ts +0 -5
- package/dist/types/BeansBalance.js +0 -2
- package/dist/types/BridgePerq.d.ts +0 -14
- package/dist/types/BridgePerq.js +0 -2
- package/dist/types/ChainId.d.ts +0 -7
- package/dist/types/ChainId.js +0 -9
- package/dist/types/ClaimSpecialEditionLoyaltyCardPayload.d.ts +0 -4
- package/dist/types/ClaimSpecialEditionLoyaltyCardPayload.js +0 -2
- package/dist/types/DeployedProject.d.ts +0 -55
- package/dist/types/DeployedProject.js +0 -2
- package/dist/types/DeployedVault.d.ts +0 -14
- package/dist/types/DeployedVault.js +0 -2
- package/dist/types/DepositToken.d.ts +0 -8
- package/dist/types/DepositToken.js +0 -2
- package/dist/types/DetailedProjectData.d.ts +0 -34
- package/dist/types/DetailedProjectData.js +0 -2
- package/dist/types/DistributionToken.d.ts +0 -6
- package/dist/types/DistributionToken.js +0 -2
- package/dist/types/ELoyaltyCardTier.d.ts +0 -10
- package/dist/types/ELoyaltyCardTier.js +0 -13
- package/dist/types/Earnings.d.ts +0 -11
- package/dist/types/Earnings.js +0 -2
- package/dist/types/LinkWalletPayload.d.ts +0 -9
- package/dist/types/LinkWalletPayload.js +0 -2
- package/dist/types/LinkedPodWallets.d.ts +0 -6
- package/dist/types/LinkedPodWallets.js +0 -2
- package/dist/types/LoyaltyCard.d.ts +0 -11
- package/dist/types/LoyaltyCard.js +0 -2
- package/dist/types/MigrationOption.d.ts +0 -6
- package/dist/types/MigrationOption.js +0 -2
- package/dist/types/MyPerqData.d.ts +0 -19
- package/dist/types/MyPerqData.js +0 -2
- package/dist/types/NFTBoost.d.ts +0 -10
- package/dist/types/NFTBoost.js +0 -2
- package/dist/types/OverallStats.d.ts +0 -7
- package/dist/types/OverallStats.js +0 -2
- package/dist/types/PerqConfig.d.ts +0 -18
- package/dist/types/PerqConfig.js +0 -37
- package/dist/types/PerqToBeansSwapInfo.d.ts +0 -8
- package/dist/types/PerqToBeansSwapInfo.js +0 -2
- package/dist/types/ProjectHistoricalTvl.d.ts +0 -4
- package/dist/types/ProjectHistoricalTvl.js +0 -2
- package/dist/types/QLFastRedeem.d.ts +0 -16
- package/dist/types/QLFastRedeem.js +0 -2
- package/dist/types/ReducedProjectData.d.ts +0 -21
- package/dist/types/ReducedProjectData.js +0 -2
- package/dist/types/SdkType.d.ts +0 -2
- package/dist/types/SdkType.js +0 -2
- package/dist/types/SignedPayload.d.ts +0 -12
- package/dist/types/SignedPayload.js +0 -2
- package/dist/types/SlotMachineSpinCost.d.ts +0 -7
- package/dist/types/SlotMachineSpinCost.js +0 -2
- package/dist/types/SpecialEditionLoyaltyCard.d.ts +0 -9
- package/dist/types/SpecialEditionLoyaltyCard.js +0 -2
- package/dist/types/Strategy.d.ts +0 -9
- package/dist/types/Strategy.js +0 -2
- package/dist/types/StretchGoal.d.ts +0 -5
- package/dist/types/StretchGoal.js +0 -2
- package/dist/types/SwapInfo.d.ts +0 -6
- package/dist/types/SwapInfo.js +0 -2
- package/dist/types/UpgradeLoyaltyCardPayload.d.ts +0 -4
- package/dist/types/UpgradeLoyaltyCardPayload.js +0 -2
- package/dist/types/UserRewards.d.ts +0 -6
- package/dist/types/UserRewards.js +0 -2
- package/dist/types/VaultData.d.ts +0 -32
- package/dist/types/VaultData.js +0 -2
- package/dist/types/VaultOperationParams.d.ts +0 -12
- package/dist/types/VaultOperationParams.js +0 -2
- package/dist/types/VaultReward.d.ts +0 -16
- package/dist/types/VaultReward.js +0 -4
- package/dist/types/VaultStats.d.ts +0 -6
- package/dist/types/VaultStats.js +0 -2
- package/dist/types/VaultType.d.ts +0 -3
- package/dist/types/VaultType.js +0 -4
- package/dist/types/VestingInfo.d.ts +0 -8
- package/dist/types/VestingInfo.js +0 -2
- package/dist/types/YelayVersion.d.ts +0 -2
- package/dist/types/YelayVersion.js +0 -2
- package/dist/types/index.d.ts +0 -34
- package/dist/types/index.js +0 -8
package/package.json
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dripfi/drip-sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.35-beta.2",
|
|
4
4
|
"description": "Drip SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"prepublish": "npm run build",
|
|
9
8
|
"build": "tsc",
|
|
10
|
-
"publish": "npm publish --access public",
|
|
11
9
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
10
|
"lint": "eslint src",
|
|
13
11
|
"pretty": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json}\""
|
|
14
12
|
},
|
|
15
13
|
"dependencies": {
|
|
16
|
-
"@dripfi/silo-sdk": "
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
14
|
+
"@dripfi/silo-sdk": "0.0.1",
|
|
15
|
+
"@gud/drift-ethers-v5": "1.0.2",
|
|
16
|
+
"@yelay-lite/sdk": "2.0.0-beta.3",
|
|
17
|
+
"ethers": "5.8.0"
|
|
19
18
|
},
|
|
20
19
|
"author": "",
|
|
21
20
|
"license": "ISC",
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"
|
|
24
|
-
"eslint": "
|
|
25
|
-
"
|
|
26
|
-
"prettier-eslint": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
22
|
+
"@stylistic/eslint-plugin-ts": "2.12.1",
|
|
23
|
+
"eslint": "9.17.0",
|
|
24
|
+
"prettier": "3.4.2",
|
|
25
|
+
"prettier-eslint": "16.3.0",
|
|
26
|
+
"typescript": "5.4.5",
|
|
27
|
+
"typescript-eslint": "8.19.1"
|
|
29
28
|
}
|
|
30
29
|
}
|
package/dist/PerqApi.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from 'ethers';
|
|
2
|
-
import { SwapInfo, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, ReducedProjectData, DetailedProjectData, Earnings, LinkedPodWallets, SuiWalletPayload, NearWalletPayload, SpecialEditionLoyaltyCard } from './types';
|
|
3
|
-
import VaultData from './types/VaultData';
|
|
4
|
-
import PerqSdk from './PerqSdk';
|
|
5
|
-
import MigrationOption from './types/MigrationOption';
|
|
6
|
-
import ProjectHistoricalTvl from './types/ProjectHistoricalTvl';
|
|
7
|
-
import ClaimSpecialEditionLoyaltyCardPayload from './types/ClaimSpecialEditionLoyaltyCardPayload';
|
|
8
|
-
import OverallStats from './types/OverallStats';
|
|
9
|
-
import { SolanaWalletPayload } from './types/LinkWalletPayload';
|
|
10
|
-
export default class PerqApi {
|
|
11
|
-
private perqSdk;
|
|
12
|
-
constructor(perqSdk: PerqSdk);
|
|
13
|
-
fetchAllPools(): Promise<VaultData[]>;
|
|
14
|
-
fetchPoolV2Details(vaultAddress: string): Promise<VaultData>;
|
|
15
|
-
fetchPoolLiteDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>;
|
|
16
|
-
fetchAllProjects(): Promise<ReducedProjectData[]>;
|
|
17
|
-
fetchProjetctDetails(projectName: string): Promise<DetailedProjectData>;
|
|
18
|
-
fetchTokenPrice(tokenName: string): Promise<number>;
|
|
19
|
-
getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number, chainId: string): Promise<string>;
|
|
20
|
-
getUserBoostedNfts(walletAddress: string, vaultAddress: string): Promise<string[]>;
|
|
21
|
-
fetchPoolStats(): Promise<VaultStats>;
|
|
22
|
-
fetchOverallStats(): Promise<OverallStats>;
|
|
23
|
-
fetchRewardsPerHour(walletAddress: string, vaultAddress: string): Promise<number>;
|
|
24
|
-
getSwapInfo(fromTokenAddress: string, toTokenAddress: string, amount: BigNumber, fromAddress: string, chainId: number): Promise<SwapInfo[]>;
|
|
25
|
-
fetchEnrichedUserWNFTForPool(vaultAddress: string, walletAddress: string): Promise<any[]>;
|
|
26
|
-
fetchAssetPerSvtAtBlock(vaultAddress: string, blocknumber: number): Promise<BigNumber>;
|
|
27
|
-
fetchUserRewards(walletAddress: string): Promise<UserRewards>;
|
|
28
|
-
fetchAllLoyaltyCards(): Promise<LoyaltyCard[]>;
|
|
29
|
-
fetchAllSpecialEditionLoyaltyCards(): Promise<SpecialEditionLoyaltyCard[]>;
|
|
30
|
-
fetchOwnedLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
|
|
31
|
-
fetchNextLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
|
|
32
|
-
fetchOwnedSpecialEditionLoyaltyCards(walletAddress: string): Promise<SpecialEditionLoyaltyCard[]>;
|
|
33
|
-
fetchBeansBalance(walletAddress: string): Promise<BeansBalance>;
|
|
34
|
-
upgradeLoyaltyCard(signedPayload: NonceEnrichedSignedPayload<UpgradeLoyaltyCardPayload>): Promise<LoyaltyCard>;
|
|
35
|
-
claimSpecialEditionCard(signedPayload: NonceEnrichedSignedPayload<ClaimSpecialEditionLoyaltyCardPayload>): Promise<SpecialEditionLoyaltyCard>;
|
|
36
|
-
fetchMyPerqData(userAddress: string): Promise<MyPerqData[]>;
|
|
37
|
-
getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
|
|
38
|
-
fetchBeansHistory(walletAddress: string): Promise<BeanEntry[]>;
|
|
39
|
-
linkSuiWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<SuiWalletPayload>): Promise<boolean>;
|
|
40
|
-
linkNearWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<NearWalletPayload>): Promise<boolean>;
|
|
41
|
-
linkSolanaWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<SolanaWalletPayload>): Promise<boolean>;
|
|
42
|
-
getPodWallets(walletAddress: string): Promise<LinkedPodWallets>;
|
|
43
|
-
getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
|
|
44
|
-
fetchLitePoolUserBalance(userAddress: string, vaultAddress: string, onChainProjectId: number): Promise<string>;
|
|
45
|
-
fetchEarnings(userAddress: string, projectName: string): Promise<Earnings>;
|
|
46
|
-
fetchMigrationOptions(vaultAddress: string, onChainProjectId: number): Promise<MigrationOption[]>;
|
|
47
|
-
fetchHistoricalTvl(projectName: string): Promise<ProjectHistoricalTvl>;
|
|
48
|
-
updateSlotMachineReadNow(): Promise<void>;
|
|
49
|
-
}
|
package/dist/PerqApi.js
DELETED
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ethers_1 = require("ethers");
|
|
4
|
-
const PERQ_TOKEN_DECIMALS = 18;
|
|
5
|
-
const WETH_TOKEN_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
|
|
6
|
-
class PerqApi {
|
|
7
|
-
perqSdk;
|
|
8
|
-
constructor(perqSdk) {
|
|
9
|
-
this.perqSdk = perqSdk;
|
|
10
|
-
}
|
|
11
|
-
async fetchAllPools() {
|
|
12
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vault`);
|
|
13
|
-
if (res.ok) {
|
|
14
|
-
const data = (await res.json());
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
throw Error(`${await res.text()}`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async fetchPoolV2Details(vaultAddress) {
|
|
22
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vault/${vaultAddress}`);
|
|
23
|
-
if (res.ok) {
|
|
24
|
-
const data = (await res.json());
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
throw Error(`${await res.text()}`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async fetchPoolLiteDetails(vaultAddress, onChainProjectId) {
|
|
32
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vault/${vaultAddress}?onChainProjectId=${onChainProjectId}`);
|
|
33
|
-
if (res.ok) {
|
|
34
|
-
const data = (await res.json());
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
throw Error(`${await res.text()}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async fetchAllProjects() {
|
|
42
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/projects`);
|
|
43
|
-
if (res.ok) {
|
|
44
|
-
const data = await res.json();
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
throw Error(`${await res.text()}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async fetchProjetctDetails(projectName) {
|
|
52
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/projects/${projectName}`);
|
|
53
|
-
if (res.ok) {
|
|
54
|
-
const data = await res.json();
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
throw Error(`${await res.text()}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async fetchTokenPrice(tokenName) {
|
|
62
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/tokenPrice?tokenName=${tokenName}`);
|
|
63
|
-
if (res.ok) {
|
|
64
|
-
const data = await res.json();
|
|
65
|
-
return data.usdPricePerToken;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
throw Error(`${await res.text()}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
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}`);
|
|
80
|
-
if (res.ok) {
|
|
81
|
-
const data = await res.json();
|
|
82
|
-
return data;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
throw Error(`${await res.text()}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async getUserBoostedNfts(walletAddress, vaultAddress) {
|
|
89
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/nftBoost/${vaultAddress}`);
|
|
90
|
-
if (res.ok) {
|
|
91
|
-
const data = await res.json();
|
|
92
|
-
return data;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
throw Error(`${await res.text()}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
async fetchPoolStats() {
|
|
99
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vaultStats`);
|
|
100
|
-
if (res.ok) {
|
|
101
|
-
const data = await res.json();
|
|
102
|
-
return data;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
throw Error(`${await res.text()}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async fetchOverallStats() {
|
|
109
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/overallStats`);
|
|
110
|
-
if (res.ok) {
|
|
111
|
-
const data = await res.json();
|
|
112
|
-
return data;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
throw Error(`${await res.text()}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async fetchRewardsPerHour(walletAddress, vaultAddress) {
|
|
119
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/rewardsPerHour/${vaultAddress}`);
|
|
120
|
-
if (res.ok) {
|
|
121
|
-
const data = await res.json();
|
|
122
|
-
return data.rewardsPerHour;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
throw Error(`${await res.text()}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async getSwapInfo(fromTokenAddress, toTokenAddress, amount, fromAddress, chainId) {
|
|
129
|
-
if (fromTokenAddress === toTokenAddress && fromTokenAddress === WETH_TOKEN_ADDRESS) {
|
|
130
|
-
return [];
|
|
131
|
-
}
|
|
132
|
-
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`;
|
|
133
|
-
const res = await fetch(url);
|
|
134
|
-
if (res.ok) {
|
|
135
|
-
const data = (await res.json());
|
|
136
|
-
return [
|
|
137
|
-
{
|
|
138
|
-
swapTarget: data.tx.to,
|
|
139
|
-
token: data.srcToken.address,
|
|
140
|
-
swapCallData: data.tx.data,
|
|
141
|
-
},
|
|
142
|
-
];
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
throw Error(`${await res.text()}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
async fetchEnrichedUserWNFTForPool(vaultAddress, walletAddress) {
|
|
149
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/spool/user/${walletAddress}/wNft/${vaultAddress}`);
|
|
150
|
-
if (res.ok) {
|
|
151
|
-
const data = await res.json();
|
|
152
|
-
return data;
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
throw Error(`${await res.text()}`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
async fetchAssetPerSvtAtBlock(vaultAddress, blocknumber) {
|
|
159
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/spool/assetBalance/${blocknumber}/${vaultAddress}`);
|
|
160
|
-
if (res.ok) {
|
|
161
|
-
const data = (await res.json());
|
|
162
|
-
return data;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
throw Error(`${await res.text()}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async fetchUserRewards(walletAddress) {
|
|
169
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/rewards`);
|
|
170
|
-
if (res.ok) {
|
|
171
|
-
const data = await res.json();
|
|
172
|
-
return data;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
throw Error(`${await res.text()}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
async fetchAllLoyaltyCards() {
|
|
179
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/loyaltyCards/all`);
|
|
180
|
-
if (res.ok) {
|
|
181
|
-
const data = await res.json();
|
|
182
|
-
return data.map((card) => ({
|
|
183
|
-
id: card.id,
|
|
184
|
-
tier: card.tier,
|
|
185
|
-
level: card.level,
|
|
186
|
-
cost: parseFloat(ethers_1.ethers.utils.formatUnits(card.cost.toString(), PERQ_TOKEN_DECIMALS)),
|
|
187
|
-
boost: card.boost,
|
|
188
|
-
chanceToUpgrade: card.chanceToUpgrade,
|
|
189
|
-
minBurnPerSpinUsd: card.minBurnPerSpinUsd,
|
|
190
|
-
}));
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
throw Error(`${await res.text()}`);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
async fetchAllSpecialEditionLoyaltyCards() {
|
|
197
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/specialEditions/all`);
|
|
198
|
-
if (res.ok) {
|
|
199
|
-
const data = await res.json();
|
|
200
|
-
return data;
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
throw Error(`${await res.text()}`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
async fetchOwnedLoyaltyCard(walletAddress) {
|
|
207
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/loyaltyCards/owned`);
|
|
208
|
-
if (res.status === 204) {
|
|
209
|
-
return {};
|
|
210
|
-
}
|
|
211
|
-
if (res.ok) {
|
|
212
|
-
const data = await res.json();
|
|
213
|
-
return {
|
|
214
|
-
id: data.id,
|
|
215
|
-
tier: data.tier,
|
|
216
|
-
level: data.level,
|
|
217
|
-
cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
|
|
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,
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
throw Error(`${await res.text()}`);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
async fetchOwnedSpecialEditionLoyaltyCards(walletAddress) {
|
|
249
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/specialEditions/owned`);
|
|
250
|
-
if (res.ok) {
|
|
251
|
-
const data = await res.json();
|
|
252
|
-
return data;
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
throw Error(`${await res.text()}`);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
async fetchBeansBalance(walletAddress) {
|
|
259
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/beans/balance`);
|
|
260
|
-
if (res.ok) {
|
|
261
|
-
const data = await res.json();
|
|
262
|
-
const beansBalance = {
|
|
263
|
-
balance: ethers_1.ethers.utils.formatUnits(data.balance, PERQ_TOKEN_DECIMALS),
|
|
264
|
-
bonusesClaimed: data.bonusesClaimed,
|
|
265
|
-
};
|
|
266
|
-
return beansBalance;
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
throw Error(`${await res.text()}`);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
async upgradeLoyaltyCard(signedPayload) {
|
|
273
|
-
const { signerAddress } = signedPayload;
|
|
274
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${signerAddress}/loyaltyCards/upgrade`, {
|
|
275
|
-
method: 'POST',
|
|
276
|
-
headers: {
|
|
277
|
-
'Content-Type': 'application/json',
|
|
278
|
-
},
|
|
279
|
-
body: JSON.stringify(signedPayload),
|
|
280
|
-
});
|
|
281
|
-
if (res.ok) {
|
|
282
|
-
const data = await res.json();
|
|
283
|
-
return {
|
|
284
|
-
id: data.id,
|
|
285
|
-
tier: data.tier,
|
|
286
|
-
level: data.level,
|
|
287
|
-
cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
|
|
288
|
-
boost: data.boost,
|
|
289
|
-
chanceToUpgrade: data.chanceToUpgrade,
|
|
290
|
-
minBurnPerSpinUsd: data.minBurnPerSpinUsd,
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
throw Error(`${await res.text()}`);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
async claimSpecialEditionCard(signedPayload) {
|
|
298
|
-
const { signerAddress } = signedPayload;
|
|
299
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${signerAddress}/specialEditions/claim`, {
|
|
300
|
-
method: 'POST',
|
|
301
|
-
headers: {
|
|
302
|
-
'Content-Type': 'application/json',
|
|
303
|
-
},
|
|
304
|
-
body: JSON.stringify(signedPayload),
|
|
305
|
-
});
|
|
306
|
-
if (res.ok) {
|
|
307
|
-
const data = await res.json();
|
|
308
|
-
return data;
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
throw Error(`${await res.text()}`);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
async fetchMyPerqData(userAddress) {
|
|
315
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${userAddress}/myperq`);
|
|
316
|
-
if (res.ok) {
|
|
317
|
-
const data = await res.json();
|
|
318
|
-
return data;
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
throw Error(`${await res.text()}`);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
async getSwapPerqForBeansInfo() {
|
|
325
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/swap/price`, {});
|
|
326
|
-
if (res.ok) {
|
|
327
|
-
const data = await res.json();
|
|
328
|
-
return data;
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
throw Error(`${await res.text()}`);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
async fetchBeansHistory(walletAddress) {
|
|
335
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/beans/history`);
|
|
336
|
-
if (res.ok) {
|
|
337
|
-
const data = await res.json();
|
|
338
|
-
const result = data.map((element) => {
|
|
339
|
-
const newBeanEntry = {
|
|
340
|
-
address: element.address,
|
|
341
|
-
reason: element.reason,
|
|
342
|
-
recycledAmount: element.recycledAmount,
|
|
343
|
-
beansAmount: element.beansAmount,
|
|
344
|
-
beansSum: element.beansSum,
|
|
345
|
-
amountDepositedInUsd: element.amountDepositedInUsd,
|
|
346
|
-
chainId: element.chainId,
|
|
347
|
-
nonce: element.nonce,
|
|
348
|
-
createdAt: element.createdAt,
|
|
349
|
-
};
|
|
350
|
-
return newBeanEntry;
|
|
351
|
-
});
|
|
352
|
-
return result;
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
throw Error(`${await res.text()}`);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
async linkSuiWalletWithEthWallet(signedPayload) {
|
|
359
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/suiWallet`, {
|
|
360
|
-
method: 'POST',
|
|
361
|
-
headers: {
|
|
362
|
-
'Content-Type': 'application/json',
|
|
363
|
-
},
|
|
364
|
-
body: JSON.stringify(signedPayload),
|
|
365
|
-
});
|
|
366
|
-
if (res.ok) {
|
|
367
|
-
return true;
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
throw Error(`${await res.text()}`);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
async linkNearWalletWithEthWallet(signedPayload) {
|
|
374
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/nearWallet`, {
|
|
375
|
-
method: 'POST',
|
|
376
|
-
headers: {
|
|
377
|
-
'Content-Type': 'application/json',
|
|
378
|
-
},
|
|
379
|
-
body: JSON.stringify(signedPayload),
|
|
380
|
-
});
|
|
381
|
-
if (res.ok) {
|
|
382
|
-
return true;
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
throw Error(`${await res.text()}`);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
async linkSolanaWalletWithEthWallet(signedPayload) {
|
|
389
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/solanaWallet`, {
|
|
390
|
-
method: 'POST',
|
|
391
|
-
headers: {
|
|
392
|
-
'Content-Type': 'application/json',
|
|
393
|
-
},
|
|
394
|
-
body: JSON.stringify(signedPayload),
|
|
395
|
-
});
|
|
396
|
-
if (res.ok) {
|
|
397
|
-
return true;
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
throw Error(`${await res.text()}`);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
async getPodWallets(walletAddress) {
|
|
404
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/podWallets/${walletAddress}`);
|
|
405
|
-
if (res.ok) {
|
|
406
|
-
const data = await res.json();
|
|
407
|
-
return data;
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
throw Error(`${await res.text()}`);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
async getNonceEnrichedPayload(payload) {
|
|
414
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/nonce`, {
|
|
415
|
-
method: 'POST',
|
|
416
|
-
headers: {
|
|
417
|
-
'Content-Type': 'application/json',
|
|
418
|
-
},
|
|
419
|
-
body: JSON.stringify({ payload }), // Wrap in payload property for BE
|
|
420
|
-
});
|
|
421
|
-
if (!res.ok) {
|
|
422
|
-
throw new Error('Failed to get nonce-enriched payload');
|
|
423
|
-
}
|
|
424
|
-
const enrichedPayload = await res.json();
|
|
425
|
-
// Return the enriched payload without the extra nesting
|
|
426
|
-
return enrichedPayload.payload;
|
|
427
|
-
}
|
|
428
|
-
async fetchLitePoolUserBalance(userAddress, vaultAddress, onChainProjectId) {
|
|
429
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/lite/balance/${userAddress}/${vaultAddress}/${onChainProjectId}`);
|
|
430
|
-
if (res.ok) {
|
|
431
|
-
const data = await res.json();
|
|
432
|
-
return data.userBalance;
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
throw Error(`${await res.text()}`);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
async fetchEarnings(userAddress, projectName) {
|
|
439
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${userAddress}/earnings/${projectName}`);
|
|
440
|
-
if (res.ok) {
|
|
441
|
-
const data = await res.json();
|
|
442
|
-
return data;
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
throw Error(`${await res.text()}`);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
async fetchMigrationOptions(vaultAddress, onChainProjectId) {
|
|
449
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/migration/options/${vaultAddress}/${onChainProjectId}`);
|
|
450
|
-
if (res.ok) {
|
|
451
|
-
const data = await res.json();
|
|
452
|
-
return data;
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
throw Error(`${await res.text()}`);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
async fetchHistoricalTvl(projectName) {
|
|
459
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/projects/tvl/${projectName}`);
|
|
460
|
-
if (res.ok) {
|
|
461
|
-
const data = await res.json();
|
|
462
|
-
return data;
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
465
|
-
throw Error(`${await res.text()}`);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
async updateSlotMachineReadNow() {
|
|
469
|
-
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/slotmachine/readnow`, { method: 'PUT' });
|
|
470
|
-
if (!res.ok) {
|
|
471
|
-
throw Error(`${await res.text()}`);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
exports.default = PerqApi;
|
package/dist/PerqSdk.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Signer, ethers } from 'ethers';
|
|
2
|
-
import { PerqConfig } from './types';
|
|
3
|
-
import PerqApi from './PerqApi';
|
|
4
|
-
import { PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqVestingContract, SlotBurnTokenContract } from './contracts';
|
|
5
|
-
import VestingPackage from './subpackages/VestingPackage';
|
|
6
|
-
import BridgePerqPackage from './subpackages/BridgePerqPackage';
|
|
7
|
-
import LitePackage from './subpackages/LitePackage';
|
|
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 { PerqSupportedChainId } from './types/PerqConfig';
|
|
16
|
-
import SiloPackage from './subpackages/SiloPackage';
|
|
17
|
-
import VaultHandler from './subpackages/VaultHandlerPackage';
|
|
18
|
-
export default class PerqSdk {
|
|
19
|
-
perqApi: PerqApi;
|
|
20
|
-
signer?: Signer;
|
|
21
|
-
lite: LitePackage;
|
|
22
|
-
vesting: VestingPackage;
|
|
23
|
-
bridge: BridgePerqPackage;
|
|
24
|
-
recycler: RecyclerPackage;
|
|
25
|
-
loyaltyCards: LoyaltyCardsPackage;
|
|
26
|
-
tokenUtils: TokenUtilsPackage;
|
|
27
|
-
user: UserPackage;
|
|
28
|
-
signHandler: SignHandlerPackage;
|
|
29
|
-
pools: PoolsPackage;
|
|
30
|
-
vault: VaultHandler;
|
|
31
|
-
perqConfig: PerqConfig;
|
|
32
|
-
perqVestingContract: PerqVestingContract;
|
|
33
|
-
perqTokenRecyclerContract: PerqTokenRecyclerContract;
|
|
34
|
-
perqSwapAndRecyclerContract: PerqSwapAndRecyclerContract;
|
|
35
|
-
slotBurnTokenContract: SlotBurnTokenContract;
|
|
36
|
-
yelayLiteSdk?: YelayLiteSdk;
|
|
37
|
-
siloPackage?: SiloPackage;
|
|
38
|
-
constructor(perqConfig: PerqConfig, chainId: PerqSupportedChainId, provider?: ethers.providers.JsonRpcProvider);
|
|
39
|
-
updateSigner(newSigner: Signer, chainId: PerqSupportedChainId): Promise<void>;
|
|
40
|
-
}
|
package/dist/PerqSdk.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const PerqApi_1 = __importDefault(require("./PerqApi"));
|
|
7
|
-
const contracts_1 = require("./contracts");
|
|
8
|
-
const VestingPackage_1 = __importDefault(require("./subpackages/VestingPackage"));
|
|
9
|
-
const BridgePerqPackage_1 = __importDefault(require("./subpackages/BridgePerqPackage"));
|
|
10
|
-
const LitePackage_1 = __importDefault(require("./subpackages/LitePackage"));
|
|
11
|
-
const RecyclerPackage_1 = __importDefault(require("./subpackages/RecyclerPackage"));
|
|
12
|
-
const LoyaltyCardsPackage_1 = __importDefault(require("./subpackages/LoyaltyCardsPackage"));
|
|
13
|
-
const sdk_1 = require("@yelay-lite/sdk");
|
|
14
|
-
const TokenUtilsPackage_1 = __importDefault(require("./subpackages/TokenUtilsPackage"));
|
|
15
|
-
const UserPackage_1 = __importDefault(require("./subpackages/UserPackage"));
|
|
16
|
-
const SignHandlerPackage_1 = __importDefault(require("./subpackages/SignHandlerPackage"));
|
|
17
|
-
const PoolsPackage_1 = __importDefault(require("./subpackages/PoolsPackage"));
|
|
18
|
-
const SiloPackage_1 = __importDefault(require("./subpackages/SiloPackage"));
|
|
19
|
-
const VaultHandlerPackage_1 = __importDefault(require("./subpackages/VaultHandlerPackage"));
|
|
20
|
-
class PerqSdk {
|
|
21
|
-
perqApi;
|
|
22
|
-
signer;
|
|
23
|
-
lite;
|
|
24
|
-
vesting;
|
|
25
|
-
bridge;
|
|
26
|
-
recycler;
|
|
27
|
-
loyaltyCards;
|
|
28
|
-
tokenUtils;
|
|
29
|
-
user;
|
|
30
|
-
signHandler;
|
|
31
|
-
pools;
|
|
32
|
-
vault;
|
|
33
|
-
perqConfig;
|
|
34
|
-
perqVestingContract;
|
|
35
|
-
perqTokenRecyclerContract;
|
|
36
|
-
perqSwapAndRecyclerContract;
|
|
37
|
-
slotBurnTokenContract;
|
|
38
|
-
yelayLiteSdk;
|
|
39
|
-
siloPackage;
|
|
40
|
-
constructor(perqConfig, chainId, provider) {
|
|
41
|
-
this.perqConfig = perqConfig;
|
|
42
|
-
const newSigner = provider?.getSigner();
|
|
43
|
-
if (newSigner) {
|
|
44
|
-
this.signer = newSigner;
|
|
45
|
-
this.yelayLiteSdk = new sdk_1.YelayLiteSdk(this.signer, chainId, false);
|
|
46
|
-
this.siloPackage = new SiloPackage_1.default(newSigner);
|
|
47
|
-
}
|
|
48
|
-
this.vesting = new VestingPackage_1.default(this);
|
|
49
|
-
this.bridge = new BridgePerqPackage_1.default(this);
|
|
50
|
-
this.lite = new LitePackage_1.default(this);
|
|
51
|
-
this.recycler = new RecyclerPackage_1.default(this);
|
|
52
|
-
this.loyaltyCards = new LoyaltyCardsPackage_1.default(this);
|
|
53
|
-
this.tokenUtils = new TokenUtilsPackage_1.default(this);
|
|
54
|
-
this.user = new UserPackage_1.default(this);
|
|
55
|
-
this.signHandler = new SignHandlerPackage_1.default(this);
|
|
56
|
-
this.pools = new PoolsPackage_1.default(this);
|
|
57
|
-
this.vault = new VaultHandlerPackage_1.default(this);
|
|
58
|
-
this.perqApi = new PerqApi_1.default(this);
|
|
59
|
-
this.perqVestingContract = new contracts_1.PerqVestingContract(this);
|
|
60
|
-
this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(this);
|
|
61
|
-
this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(this);
|
|
62
|
-
this.slotBurnTokenContract = new contracts_1.SlotBurnTokenContract(this);
|
|
63
|
-
}
|
|
64
|
-
async updateSigner(newSigner, chainId) {
|
|
65
|
-
this.signer = newSigner;
|
|
66
|
-
this.yelayLiteSdk = new sdk_1.YelayLiteSdk(this.signer, chainId, false);
|
|
67
|
-
this.perqVestingContract = new contracts_1.PerqVestingContract(this);
|
|
68
|
-
this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(this);
|
|
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);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.default = PerqSdk;
|