@dripfi/drip-sdk 1.3.9 → 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 -5
- package/dist/DripConfig.js +4 -8
- 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 -18
- package/dist/index.js +20 -9
- package/dist/perq/PerqApi.d.ts +4 -0
- package/dist/perq/PerqApi.js +9 -0
- package/dist/perq/PerqConfig.d.ts +5 -0
- package/dist/perq/PerqConfig.js +20 -0
- package/dist/perq/PerqSdk.d.ts +9 -0
- package/dist/perq/PerqSdk.js +26 -0
- package/dist/types/BeansBalance.d.ts +2 -1
- package/dist/types/Chain.d.ts +5 -0
- package/dist/types/Chain.js +8 -0
- package/dist/types/DeployedProject.d.ts +4 -2
- package/dist/types/DeployedVault.d.ts +3 -4
- package/dist/types/LoyaltyCard.d.ts +3 -2
- package/dist/types/MyPerqData.d.ts +1 -2
- package/dist/types/NFTBoost.d.ts +2 -1
- package/dist/types/PerqToBeansSwapInfo.d.ts +2 -1
- package/dist/types/QLFastRedeem.d.ts +3 -2
- package/dist/types/Strategy.d.ts +2 -1
- package/dist/types/StretchGoal.d.ts +2 -1
- package/dist/types/SwapInfo.d.ts +2 -1
- package/dist/types/UpgradeLoyaltyCardPayload.d.ts +2 -1
- package/dist/types/UserRewards.d.ts +2 -1
- package/dist/types/UserVaultBalance.d.ts +2 -1
- package/dist/types/Vault.d.ts +4 -8
- package/dist/types/VaultReward.d.ts +2 -1
- package/dist/types/VaultStats.d.ts +2 -1
- package/dist/types/VaultType.d.ts +2 -1
- package/dist/types/VestingInfo.d.ts +2 -1
- package/dist/types/YelayVersion.d.ts +2 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/index.js +10 -0
- package/package.json +2 -1
- package/dist/types/CacheVaultRewards.d.ts +0 -13
- package/dist/types/UserBalance.d.ts +0 -18
- package/dist/types/UserBalance.js +0 -2
- package/dist/types/VaultClaimData.d.ts +0 -6
- package/dist/types/VaultClaimData.js +0 -2
- package/dist/types/VaultDepositToken.d.ts +0 -7
- 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/dist/types/{CacheVaultRewards.js → YelayVersion.js} +0 -0
package/dist/DripApi.d.ts
CHANGED
@@ -1,25 +1,11 @@
|
|
1
1
|
import { BigNumber } from 'ethers';
|
2
|
-
import { Vault } from './types
|
3
|
-
import { SwapInfo } from './types/SwapInfo';
|
4
|
-
import { QLFastRedeem } from './types/QLFastRedeem';
|
5
|
-
import { UserRewards } from './types/UserRewards';
|
6
|
-
import { VaultStats } from './types/VaultStats';
|
7
|
-
import { UserBalance } from './types/UserBalance';
|
8
|
-
import { VaultClaimData } from './types/VaultClaimData';
|
9
|
-
import MyPerqData from './types/MyPerqData';
|
10
|
-
import { LoyaltyCard } from './types/LoyaltyCard';
|
11
|
-
import { BeansBalance } from './types/BeansBalance';
|
12
|
-
import { PerqToBeansSwapInfo } from './types/PerqToBeansSwapInfo';
|
13
|
-
import BeanEntry from './types/BeanEntry';
|
14
|
-
import { NonceEnrichedSignedPayload, NonceEnrichedPayload } from './types/SignedPayload';
|
15
|
-
import { UpgradeLoyaltyCardPayload } from './types/UpgradeLoyaltyCardPayload';
|
2
|
+
import { Vault, SwapInfo, QLFastRedeem, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload } from './types';
|
16
3
|
export default class DripApi {
|
17
4
|
route: string;
|
18
5
|
constructor(route: string);
|
19
6
|
fetchAllVaults(): Promise<Vault[]>;
|
20
7
|
fetchTokenPrice(tokenName: string): Promise<number>;
|
21
8
|
getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
|
22
|
-
getUserBalance(walletAddress: string): Promise<UserBalance>;
|
23
9
|
getUserBoostedNfts(walletAddress: string, vaultAddress: string): Promise<string[]>;
|
24
10
|
fetchVaultStats(): Promise<VaultStats>;
|
25
11
|
fetchVaultDetails(vaultAddress: string): Promise<Vault>;
|
@@ -33,7 +19,6 @@ export default class DripApi {
|
|
33
19
|
fetchAssetPerSvtAtBlock(vaultAddress: string, blocknumber: number): Promise<BigNumber>;
|
34
20
|
fetchFastWithdrawNFTs(vaultAddress: string, walletAddress: string): Promise<QLFastRedeem[]>;
|
35
21
|
fetchUserRewards(walletAddress: string): Promise<UserRewards>;
|
36
|
-
fetchVaultsClaimableData(walletAddress: string): Promise<VaultClaimData>;
|
37
22
|
fetchAllLoyaltyCards(): Promise<LoyaltyCard[]>;
|
38
23
|
fetchOwnedLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
|
39
24
|
fetchBeansBalance(walletAddress: string): Promise<BeansBalance>;
|
package/dist/DripApi.js
CHANGED
@@ -44,16 +44,6 @@ class DripApi {
|
|
44
44
|
throw Error(`${await res.text()}`);
|
45
45
|
}
|
46
46
|
}
|
47
|
-
async getUserBalance(walletAddress) {
|
48
|
-
const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/deposits`);
|
49
|
-
if (res.ok) {
|
50
|
-
const data = await res.json();
|
51
|
-
return data;
|
52
|
-
}
|
53
|
-
else {
|
54
|
-
throw Error(`${await res.text()}`);
|
55
|
-
}
|
56
|
-
}
|
57
47
|
async getUserBoostedNfts(walletAddress, vaultAddress) {
|
58
48
|
const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/nftBoost/${vaultAddress}`);
|
59
49
|
if (res.ok) {
|
@@ -194,16 +184,6 @@ class DripApi {
|
|
194
184
|
throw Error(`${await res.text()}`);
|
195
185
|
}
|
196
186
|
}
|
197
|
-
async fetchVaultsClaimableData(walletAddress) {
|
198
|
-
const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/claimableVaults`);
|
199
|
-
if (res.ok) {
|
200
|
-
const data = await res.json();
|
201
|
-
return data;
|
202
|
-
}
|
203
|
-
else {
|
204
|
-
throw Error(`${await res.text()}`);
|
205
|
-
}
|
206
|
-
}
|
207
187
|
async fetchAllLoyaltyCards() {
|
208
188
|
const res = await fetch(`${this.route}/api-be/api/loyaltyCards/all`);
|
209
189
|
if (res.ok) {
|
package/dist/DripConfig.d.ts
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
import { SDKConfig } from '@spool.fi/spool-v2-sdk';
|
2
1
|
import { Signer } from 'ethers';
|
2
|
+
import { SDKConfig } from '@spool.fi/spool-v2-sdk';
|
3
|
+
import { Chain } from './types';
|
3
4
|
export declare const NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
4
5
|
export declare const PERQ_TOKEN_DECIMALS = 18;
|
5
|
-
export declare enum Chain {
|
6
|
-
MAINNET = "mainnet",
|
7
|
-
SEPOLIA = "sepolia"
|
8
|
-
}
|
9
6
|
export declare class DripConfig {
|
10
7
|
internalConfig: SDKConfig;
|
11
8
|
dripRoute: string;
|
package/dist/DripConfig.js
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DripConfig = exports.
|
3
|
+
exports.DripConfig = exports.PERQ_TOKEN_DECIMALS = exports.NULL_ADDRESS = void 0;
|
4
4
|
const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
|
5
|
+
const types_1 = require("./types");
|
5
6
|
exports.NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
|
6
7
|
exports.PERQ_TOKEN_DECIMALS = 18;
|
7
|
-
var Chain;
|
8
|
-
(function (Chain) {
|
9
|
-
Chain["MAINNET"] = "mainnet";
|
10
|
-
Chain["SEPOLIA"] = "sepolia";
|
11
|
-
})(Chain || (exports.Chain = Chain = {}));
|
12
8
|
const SUBGRAPH_URL_SEPOLIA = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2-sepolia/api';
|
13
9
|
const RECYCLER_ADDRESS_SEPOLIA = '0x07F2264E199D62afe07E8288eC9D36d155fc3f24';
|
14
10
|
const SWAP_AND_RECYCLER_ADDRESS_SEPOLIA = '0xA4ed357FF233731860Ec8D0446FD95756d564014';
|
@@ -32,7 +28,7 @@ class DripConfig {
|
|
32
28
|
perqVestingAddress;
|
33
29
|
constructor(chain, dripRoute) {
|
34
30
|
switch (chain) {
|
35
|
-
case Chain.MAINNET:
|
31
|
+
case types_1.Chain.MAINNET:
|
36
32
|
this.internalConfig = (0, spool_v2_sdk_1.getMainnetConfig)(SUBGRAPH_URL_MAINNET);
|
37
33
|
this.dripRoute = dripRoute !== undefined ? dripRoute : PROD_BACKEND_ROUTE;
|
38
34
|
this.dripTokenAddress = DRIP_TOKEN_ADDRESS_MAINNET;
|
@@ -40,7 +36,7 @@ class DripConfig {
|
|
40
36
|
this.dripSwapAndRecyclerAddress = SWAP_AND_RECYCLER_ADDRESS_MAINNET;
|
41
37
|
this.perqVestingAddress = VESTING_ADDRESS_MAINNET;
|
42
38
|
break;
|
43
|
-
case Chain.SEPOLIA:
|
39
|
+
case types_1.Chain.SEPOLIA:
|
44
40
|
this.internalConfig = (0, spool_v2_sdk_1.getSepoliaConfig)(SUBGRAPH_URL_SEPOLIA);
|
45
41
|
this.dripRoute = dripRoute !== undefined ? dripRoute : DEV_BACKEND_ROUTE;
|
46
42
|
this.dripTokenAddress = DRIP_TOKEN_ADDRESS_SEPOLIA;
|
package/dist/DripSdk.d.ts
CHANGED
@@ -1,18 +1,5 @@
|
|
1
1
|
import { BigNumber, Signer } from 'ethers';
|
2
|
-
import { UserRewards } from './types
|
3
|
-
import { VaultStats } from './types/VaultStats';
|
4
|
-
import { UserBalance } from './types/UserBalance';
|
5
|
-
import { UserVaultBalance } from './types/UserVaultBalance';
|
6
|
-
import { VaultClaimData } from './types/VaultClaimData';
|
7
|
-
import { Vault } from './types/Vault';
|
8
|
-
import { LoyaltyCard } from './types/LoyaltyCard';
|
9
|
-
import MyPerqData from './types/MyPerqData';
|
10
|
-
import { Chain } from './DripConfig';
|
11
|
-
import { BeansBalance } from './types/BeansBalance';
|
12
|
-
import { PerqToBeansSwapInfo } from './types/PerqToBeansSwapInfo';
|
13
|
-
import BeanEntry from './types/BeanEntry';
|
14
|
-
import { VestingInfo } from './types/VestingInfo';
|
15
|
-
import { NonceEnrichedSignedPayload } from './types/SignedPayload';
|
2
|
+
import { Vault, Chain, UserRewards, VaultStats, UserVaultBalance, LoyaltyCard, NonceEnrichedSignedPayload, MyPerqData, BeansBalance, BeanEntry, PerqToBeansSwapInfo, VestingInfo } from './types';
|
16
3
|
export default class DripSdk {
|
17
4
|
private dripApi;
|
18
5
|
private dripTokenContract;
|
@@ -35,7 +22,6 @@ export default class DripSdk {
|
|
35
22
|
getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>;
|
36
23
|
getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>;
|
37
24
|
getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
|
38
|
-
getUserBalance(): Promise<UserBalance>;
|
39
25
|
getUserBoostedNfts(vaultAddress: string): Promise<string[]>;
|
40
26
|
getRewardsPerHour(vaultAddress: string): Promise<number>;
|
41
27
|
getRewards(): Promise<UserRewards>;
|
@@ -47,7 +33,6 @@ export default class DripSdk {
|
|
47
33
|
private doSwapAndDeposit;
|
48
34
|
withdraw(vaultAddress: string, amountToWithdraw?: string): Promise<string>;
|
49
35
|
claimWithdraws(vaultAddress: string): Promise<string>;
|
50
|
-
getVaultsClaimableData(): Promise<VaultClaimData>;
|
51
36
|
getBeansBalance(): Promise<BeansBalance>;
|
52
37
|
getBeansHistory(): Promise<BeanEntry[]>;
|
53
38
|
recycleTokens(tokenAddress: string | undefined, amountToRecycle: string, beneficiary: string | undefined, price: string, deadline: string, signature: string): Promise<string>;
|
package/dist/DripSdk.js
CHANGED
@@ -3,15 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
|
7
6
|
const ethers_1 = require("ethers");
|
7
|
+
const utils_1 = require("ethers/lib/utils");
|
8
|
+
const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
|
8
9
|
const DripConfig_1 = require("./DripConfig");
|
9
10
|
const DripApi_1 = __importDefault(require("./DripApi"));
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const
|
11
|
+
const PerqTokenContract_1 = __importDefault(require("./contracts/PerqTokenContract"));
|
12
|
+
const PerqTokenRecyclerContract_1 = __importDefault(require("./contracts/PerqTokenRecyclerContract"));
|
13
|
+
const PerqSwapAndRecyclerContract_1 = __importDefault(require("./contracts/PerqSwapAndRecyclerContract"));
|
13
14
|
const PerqVestingContract_1 = __importDefault(require("./contracts/PerqVestingContract"));
|
14
|
-
const utils_1 = require("ethers/lib/utils");
|
15
15
|
const WethTokenAbi_json_1 = __importDefault(require("./abi/WethTokenAbi.json"));
|
16
16
|
class DripSdk {
|
17
17
|
dripApi;
|
@@ -29,9 +29,9 @@ class DripSdk {
|
|
29
29
|
this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(this.dripConfig.internalConfig, signer);
|
30
30
|
}
|
31
31
|
this.dripApi = new DripApi_1.default(this.dripConfig.dripRoute);
|
32
|
-
this.dripTokenContract = new
|
33
|
-
this.dripTokenRecyclerContract = new
|
34
|
-
this.dripSwapAndRecyclerContract = new
|
32
|
+
this.dripTokenContract = new PerqTokenContract_1.default(this.dripConfig.dripTokenAddress, signer);
|
33
|
+
this.dripTokenRecyclerContract = new PerqTokenRecyclerContract_1.default(this.dripConfig.dripTokenRecyclerAddress, signer);
|
34
|
+
this.dripSwapAndRecyclerContract = new PerqSwapAndRecyclerContract_1.default(this.dripConfig.dripSwapAndRecyclerAddress, signer);
|
35
35
|
this.perqVestingContract = new PerqVestingContract_1.default(this.dripConfig.perqVestingAddress, signer);
|
36
36
|
}
|
37
37
|
async getAllVaults() {
|
@@ -110,10 +110,6 @@ class DripSdk {
|
|
110
110
|
async getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals) {
|
111
111
|
return this.dripApi.getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals);
|
112
112
|
}
|
113
|
-
async getUserBalance() {
|
114
|
-
const userAddress = await this.signer.getAddress();
|
115
|
-
return this.dripApi.getUserBalance(userAddress);
|
116
|
-
}
|
117
113
|
async getUserBoostedNfts(vaultAddress) {
|
118
114
|
const userAddress = await this.signer.getAddress();
|
119
115
|
return this.dripApi.getUserBoostedNfts(userAddress, vaultAddress);
|
@@ -255,13 +251,6 @@ class DripSdk {
|
|
255
251
|
const txReceipt = await claimWithdrawTx.wait();
|
256
252
|
return txReceipt.transactionHash;
|
257
253
|
}
|
258
|
-
async getVaultsClaimableData() {
|
259
|
-
if (!this.signer) {
|
260
|
-
throw Error('No signer provided');
|
261
|
-
}
|
262
|
-
const userAddress = await this.signer.getAddress();
|
263
|
-
return await this.dripApi.fetchVaultsClaimableData(userAddress);
|
264
|
-
}
|
265
254
|
async getBeansBalance() {
|
266
255
|
const userAddress = await this.signer.getAddress();
|
267
256
|
return this.dripApi.fetchBeansBalance(userAddress);
|
package/dist/abi/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
declare const _default: {
|
2
|
-
readonly
|
2
|
+
readonly PERQ_SWAP_AND_RECYCLER_ABI: {
|
3
3
|
inputs: {
|
4
4
|
internalType: string;
|
5
5
|
name: string;
|
@@ -26,7 +26,7 @@ declare const _default: {
|
|
26
26
|
stateMutability: string;
|
27
27
|
type: string;
|
28
28
|
}[];
|
29
|
-
readonly
|
29
|
+
readonly PERQ_TOKEN_ABI: {
|
30
30
|
constant: boolean;
|
31
31
|
inputs: {
|
32
32
|
name: string;
|
package/dist/abi/index.js
CHANGED
@@ -3,15 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const
|
6
|
+
const PerqSwapAndRecyclerAbi_json_1 = __importDefault(require("./PerqSwapAndRecyclerAbi.json"));
|
7
7
|
const WethTokenAbi_json_1 = __importDefault(require("./WethTokenAbi.json"));
|
8
|
-
const
|
8
|
+
const PerqTokenAbi_json_1 = __importDefault(require("./PerqTokenAbi.json"));
|
9
9
|
const TokenRecyclerAbi_json_1 = __importDefault(require("./TokenRecyclerAbi.json"));
|
10
10
|
const PerqVestingAbi_json_1 = __importDefault(require("./PerqVestingAbi.json"));
|
11
11
|
exports.default = {
|
12
|
-
|
12
|
+
PERQ_SWAP_AND_RECYCLER_ABI: PerqSwapAndRecyclerAbi_json_1.default,
|
13
13
|
WETH_TOKEN_ABI: WethTokenAbi_json_1.default,
|
14
|
-
|
14
|
+
PERQ_TOKEN_ABI: PerqTokenAbi_json_1.default,
|
15
15
|
TOKEN_RECYCLER_ABI: TokenRecyclerAbi_json_1.default,
|
16
16
|
PERQ_VESTING_ABI: PerqVestingAbi_json_1.default,
|
17
17
|
};
|
package/dist/contracts/{DripSwapAndRecyclerContract.d.ts → PerqSwapAndRecyclerContract.d.ts}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ContractTransaction, ethers } from 'ethers';
|
2
|
-
import
|
3
|
-
export default class
|
2
|
+
import BasePerqContract from './BasePerqContract';
|
3
|
+
export default class PerqSwapAndRecyclerContract extends BasePerqContract {
|
4
4
|
constructor(address: string, signer?: ethers.Signer);
|
5
5
|
swapAndRecycle(beneficiary: string | undefined, path: string[], amountInWithDecimals: string, minAmountOutWithDecimals: string, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
|
6
6
|
swapETHAndRecycle(beneficiary: string | undefined, path: string[], minAmountOutWithDecimals: string, amountInEth: string, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const ethers_1 = require("ethers");
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const PerqSwapAndRecyclerAbi_json_1 = __importDefault(require("../abi/PerqSwapAndRecyclerAbi.json"));
|
8
|
+
const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
|
9
9
|
const DripConfig_1 = require("../DripConfig");
|
10
|
-
class
|
10
|
+
class PerqSwapAndRecyclerContract extends BasePerqContract_1.default {
|
11
11
|
constructor(address, signer) {
|
12
|
-
super(address, new ethers_1.ethers.utils.Interface(
|
12
|
+
super(address, new ethers_1.ethers.utils.Interface(PerqSwapAndRecyclerAbi_json_1.default), signer);
|
13
13
|
}
|
14
14
|
async swapAndRecycle(beneficiary = DripConfig_1.NULL_ADDRESS, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature) {
|
15
15
|
if (!this.contract.signer) {
|
@@ -26,4 +26,4 @@ class DripSwapAndRecyclerContract extends BaseDripContract_1.default {
|
|
26
26
|
});
|
27
27
|
}
|
28
28
|
}
|
29
|
-
exports.default =
|
29
|
+
exports.default = PerqSwapAndRecyclerContract;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { BigNumber, ContractTransaction, ethers } from 'ethers';
|
2
|
-
import
|
3
|
-
export default class
|
2
|
+
import BasePerqContract from './BasePerqContract';
|
3
|
+
export default class PerqTokenContract extends BasePerqContract {
|
4
4
|
constructor(address: string, signer?: ethers.Signer);
|
5
5
|
getAllowance(spender: string): Promise<BigNumber>;
|
6
6
|
approve(spender: string, amount: BigNumber): Promise<ContractTransaction>;
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const ethers_1 = require("ethers");
|
7
|
-
const
|
8
|
-
const
|
9
|
-
class
|
7
|
+
const PerqTokenAbi_json_1 = __importDefault(require("../abi/PerqTokenAbi.json"));
|
8
|
+
const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
|
9
|
+
class PerqTokenContract extends BasePerqContract_1.default {
|
10
10
|
constructor(address, signer) {
|
11
|
-
super(address, new ethers_1.ethers.utils.Interface(
|
11
|
+
super(address, new ethers_1.ethers.utils.Interface(PerqTokenAbi_json_1.default), signer);
|
12
12
|
}
|
13
13
|
async getAllowance(spender) {
|
14
14
|
if (!this.contract.signer) {
|
@@ -23,4 +23,4 @@ class DripTokenContract extends BaseDripContract_1.default {
|
|
23
23
|
return await this.contract.approve(spender, amount.toString());
|
24
24
|
}
|
25
25
|
}
|
26
|
-
exports.default =
|
26
|
+
exports.default = PerqTokenContract;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ContractTransaction, ethers } from 'ethers';
|
2
|
-
import BaseDripContract from './
|
2
|
+
import BaseDripContract from './BasePerqContract';
|
3
3
|
export default class DripTokenRecyclerContract extends BaseDripContract {
|
4
4
|
constructor(address: string, signer?: ethers.Signer);
|
5
5
|
recycle(amountToRecycle: string, beneficiary: string | undefined, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const ethers_1 = require("ethers");
|
7
7
|
const TokenRecyclerAbi_json_1 = __importDefault(require("../abi/TokenRecyclerAbi.json"));
|
8
|
-
const
|
8
|
+
const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
|
9
9
|
const DripConfig_1 = require("../DripConfig");
|
10
|
-
class DripTokenRecyclerContract extends
|
10
|
+
class DripTokenRecyclerContract extends BasePerqContract_1.default {
|
11
11
|
constructor(address, signer) {
|
12
12
|
super(address, new ethers_1.ethers.utils.Interface(TokenRecyclerAbi_json_1.default), signer);
|
13
13
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { BigNumber, ContractTransaction, ethers } from 'ethers';
|
2
|
-
import
|
3
|
-
export default class PerqVestingContract extends
|
2
|
+
import BasePerqContract from './BasePerqContract';
|
3
|
+
export default class PerqVestingContract extends BasePerqContract {
|
4
4
|
constructor(address: string, signer?: ethers.Signer);
|
5
5
|
start(): Promise<BigNumber>;
|
6
6
|
end(): Promise<BigNumber>;
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const ethers_1 = require("ethers");
|
7
7
|
const PerqVestingAbi_json_1 = __importDefault(require("../abi/PerqVestingAbi.json"));
|
8
|
-
const
|
9
|
-
class PerqVestingContract extends
|
8
|
+
const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
|
9
|
+
class PerqVestingContract extends BasePerqContract_1.default {
|
10
10
|
constructor(address, signer) {
|
11
11
|
super(address, new ethers_1.ethers.utils.Interface(PerqVestingAbi_json_1.default), signer);
|
12
12
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import BasePerqContract from './BasePerqContract';
|
2
|
+
import PerqSwapAndRecyclerContract from './PerqSwapAndRecyclerContract';
|
3
|
+
import PerqTokenRecyclerContract from './PerqTokenRecyclerContract';
|
4
|
+
import PerqTokenContract from './PerqTokenContract';
|
5
|
+
import PerqVestingContract from './PerqVestingContract';
|
6
|
+
declare const _default: {
|
7
|
+
BasePerqContract: typeof BasePerqContract;
|
8
|
+
PerqSwapAndRecyclerContract: typeof PerqSwapAndRecyclerContract;
|
9
|
+
PerqTokenRecyclerContract: typeof PerqTokenRecyclerContract;
|
10
|
+
PerqTokenContract: typeof PerqTokenContract;
|
11
|
+
PerqVestingContract: typeof PerqVestingContract;
|
12
|
+
};
|
13
|
+
export default _default;
|
@@ -0,0 +1,17 @@
|
|
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 BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
|
7
|
+
const PerqSwapAndRecyclerContract_1 = __importDefault(require("./PerqSwapAndRecyclerContract"));
|
8
|
+
const PerqTokenRecyclerContract_1 = __importDefault(require("./PerqTokenRecyclerContract"));
|
9
|
+
const PerqTokenContract_1 = __importDefault(require("./PerqTokenContract"));
|
10
|
+
const PerqVestingContract_1 = __importDefault(require("./PerqVestingContract"));
|
11
|
+
exports.default = {
|
12
|
+
BasePerqContract: BasePerqContract_1.default,
|
13
|
+
PerqSwapAndRecyclerContract: PerqSwapAndRecyclerContract_1.default,
|
14
|
+
PerqTokenRecyclerContract: PerqTokenRecyclerContract_1.default,
|
15
|
+
PerqTokenContract: PerqTokenContract_1.default,
|
16
|
+
PerqVestingContract: PerqVestingContract_1.default,
|
17
|
+
};
|
package/dist/index.d.ts
CHANGED
@@ -1,28 +1,14 @@
|
|
1
1
|
import DripSdk from './DripSdk';
|
2
|
-
import
|
3
|
-
import { VaultReward } from './types/VaultReward';
|
4
|
-
import { NFTBoost } from './types/NFTBoost';
|
5
|
-
import { Strategy } from './types/Strategy';
|
6
|
-
import { StretchGoal } from './types/StretchGoal';
|
7
|
-
import { SwapInfo } from './types/SwapInfo';
|
8
|
-
import { VaultDepositToken } from './types/VaultDepositToken';
|
9
|
-
import { VaultType } from './types/VaultType';
|
10
|
-
import { UserVaultBalance } from './types/UserVaultBalance';
|
11
|
-
import { UserBalance } from './types/UserBalance';
|
12
|
-
import { VaultStats } from './types/VaultStats';
|
13
|
-
import { Chain } from './DripConfig';
|
14
|
-
import MyPerqData from './types/MyPerqData';
|
15
|
-
import ELoyaltyCardTier from './types/ELoyaltyCardTier';
|
16
|
-
import BeanEntry from './types/BeanEntry';
|
17
|
-
import DRIP_SWAP_AND_RECYCLER_ABI from './abi/DripSwapAndRecyclerAbi.json';
|
2
|
+
import DRIP_SWAP_AND_RECYCLER_ABI from './abi/PerqSwapAndRecyclerAbi.json';
|
18
3
|
import WETH_TOKEN_ABI from './abi/WethTokenAbi.json';
|
19
|
-
import DRIP_TOKEN_ABI from './abi/
|
4
|
+
import DRIP_TOKEN_ABI from './abi/PerqTokenAbi.json';
|
20
5
|
import TOKEN_RECYCLER_ABI from './abi/TokenRecyclerAbi.json';
|
21
6
|
import PERQ_VESTING_ABI from './abi/PerqVestingAbi.json';
|
22
7
|
import abi from './abi';
|
8
|
+
export * from './types';
|
23
9
|
export { DRIP_SWAP_AND_RECYCLER_ABI, // TODO REMOVE THIS LINE
|
24
10
|
WETH_TOKEN_ABI, // TODO REMOVE THIS LINE
|
25
11
|
DRIP_TOKEN_ABI, // TODO REMOVE THIS LINE
|
26
12
|
TOKEN_RECYCLER_ABI, // TODO REMOVE THIS LINE
|
27
13
|
PERQ_VESTING_ABI, // TODO REMOVE THIS LINE
|
28
|
-
|
14
|
+
DripSdk, abi, };
|
package/dist/index.js
CHANGED
@@ -1,21 +1,31 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
18
|
};
|
5
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.abi = exports.
|
20
|
+
exports.abi = exports.DripSdk = exports.PERQ_VESTING_ABI = exports.TOKEN_RECYCLER_ABI = exports.DRIP_TOKEN_ABI = exports.WETH_TOKEN_ABI = exports.DRIP_SWAP_AND_RECYCLER_ABI = void 0;
|
7
21
|
const DripSdk_1 = __importDefault(require("./DripSdk"));
|
8
22
|
exports.DripSdk = DripSdk_1.default;
|
9
|
-
const
|
10
|
-
|
11
|
-
const ELoyaltyCardTier_1 = __importDefault(require("./types/ELoyaltyCardTier"));
|
12
|
-
exports.ELoyaltyCardTier = ELoyaltyCardTier_1.default;
|
13
|
-
const DripSwapAndRecyclerAbi_json_1 = __importDefault(require("./abi/DripSwapAndRecyclerAbi.json")); // TODO REMOVE THIS LINE
|
14
|
-
exports.DRIP_SWAP_AND_RECYCLER_ABI = DripSwapAndRecyclerAbi_json_1.default;
|
23
|
+
const PerqSwapAndRecyclerAbi_json_1 = __importDefault(require("./abi/PerqSwapAndRecyclerAbi.json")); // TODO REMOVE THIS LINE
|
24
|
+
exports.DRIP_SWAP_AND_RECYCLER_ABI = PerqSwapAndRecyclerAbi_json_1.default;
|
15
25
|
const WethTokenAbi_json_1 = __importDefault(require("./abi/WethTokenAbi.json")); // TODO REMOVE THIS LINE
|
16
26
|
exports.WETH_TOKEN_ABI = WethTokenAbi_json_1.default;
|
17
|
-
const
|
18
|
-
exports.DRIP_TOKEN_ABI =
|
27
|
+
const PerqTokenAbi_json_1 = __importDefault(require("./abi/PerqTokenAbi.json")); // TODO REMOVE THIS LINE
|
28
|
+
exports.DRIP_TOKEN_ABI = PerqTokenAbi_json_1.default;
|
19
29
|
const TokenRecyclerAbi_json_1 = __importDefault(require("./abi/TokenRecyclerAbi.json")); // TODO REMOVE THIS LINE
|
20
30
|
exports.TOKEN_RECYCLER_ABI = TokenRecyclerAbi_json_1.default;
|
21
31
|
const PerqVestingAbi_json_1 = __importDefault(require("./abi/PerqVestingAbi.json")); // TODO REMOVE THIS LINE
|
@@ -23,3 +33,4 @@ exports.PERQ_VESTING_ABI = PerqVestingAbi_json_1.default;
|
|
23
33
|
// FROM NOW ON, THIS IS THE NEW STRUCTURE:
|
24
34
|
const abi_1 = __importDefault(require("./abi"));
|
25
35
|
exports.abi = abi_1.default;
|
36
|
+
__exportStar(require("./types"), exports);
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PerqConfig = void 0;
|
4
|
+
const index_1 = require("../index");
|
5
|
+
const PROD_BACKEND_ROUTE = 'https://perq.finance';
|
6
|
+
const DEV_BACKEND_ROUTE = 'https://dev.perq.finance';
|
7
|
+
class PerqConfig {
|
8
|
+
perqRoute;
|
9
|
+
constructor(chain, perqRoute) {
|
10
|
+
switch (chain) {
|
11
|
+
case index_1.Chain.MAINNET:
|
12
|
+
this.perqRoute = perqRoute !== undefined ? perqRoute : PROD_BACKEND_ROUTE;
|
13
|
+
break;
|
14
|
+
case index_1.Chain.SEPOLIA:
|
15
|
+
this.perqRoute = perqRoute !== undefined ? perqRoute : DEV_BACKEND_ROUTE;
|
16
|
+
break;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
exports.PerqConfig = PerqConfig;
|
@@ -0,0 +1,26 @@
|
|
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 sdk_1 = require("@yelay-lite/sdk");
|
7
|
+
const PerqApi_1 = __importDefault(require("./PerqApi"));
|
8
|
+
const PerqConfig_1 = require("./PerqConfig");
|
9
|
+
const YELAY_LITE_BACKEND_URL = 'http://134.209.255.15:3000';
|
10
|
+
const BASE_RPC_URL = 'https://sly-virulent-pallet.base-mainnet.quiknode.pro/22e8158f3fe6a39562769d29f885d4102f08715a/';
|
11
|
+
class PerqSdk {
|
12
|
+
perqApi;
|
13
|
+
perqConfig;
|
14
|
+
signer;
|
15
|
+
yelayLiteSdk;
|
16
|
+
constructor(chain, signer, perqRoute) {
|
17
|
+
this.signer = signer;
|
18
|
+
this.perqConfig = new PerqConfig_1.PerqConfig(chain, perqRoute);
|
19
|
+
this.perqApi = new PerqApi_1.default(this.perqConfig.perqRoute);
|
20
|
+
this.yelayLiteSdk = new sdk_1.YelayLiteSdk({
|
21
|
+
backendUrl: YELAY_LITE_BACKEND_URL,
|
22
|
+
rpcUrl: BASE_RPC_URL,
|
23
|
+
});
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.default = PerqSdk;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { StretchGoal } from './
|
2
|
-
|
1
|
+
import { YelayVersion, StretchGoal } from './index';
|
2
|
+
type DeployedProject = {
|
3
3
|
id: number | undefined;
|
4
4
|
projectName: string;
|
5
5
|
owners: string[];
|
@@ -35,7 +35,9 @@ export type DeployedProject = {
|
|
35
35
|
coingeckoId?: string;
|
36
36
|
projectType: string;
|
37
37
|
isFeatured: boolean;
|
38
|
+
yelayVersion: YelayVersion;
|
38
39
|
};
|
40
|
+
export default DeployedProject;
|
39
41
|
export type ProjectBacker = {
|
40
42
|
name: string;
|
41
43
|
image: string;
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import { DeployedProject } from './
|
2
|
-
|
3
|
-
import { VaultType } from './VaultType';
|
4
|
-
export type DeployedVault = {
|
1
|
+
import { DeployedProject, VaultReward, VaultType } from './index';
|
2
|
+
type DeployedVault = {
|
5
3
|
projectId: number;
|
6
4
|
vaultAddress: string;
|
7
5
|
liveUntil: string;
|
@@ -13,3 +11,4 @@ export type DeployedVault = {
|
|
13
11
|
coingeckoId?: string;
|
14
12
|
expectedTge?: string;
|
15
13
|
};
|
14
|
+
export default DeployedVault;
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import ELoyaltyCardTier from './
|
2
|
-
|
1
|
+
import { ELoyaltyCardTier } from './index';
|
2
|
+
type LoyaltyCard = {
|
3
3
|
id: string;
|
4
4
|
tier: ELoyaltyCardTier;
|
5
5
|
level: number;
|
6
6
|
cost: number;
|
7
7
|
boost: number;
|
8
8
|
};
|
9
|
+
export default LoyaltyCard;
|