@dripfi/drip-sdk 1.2.4 → 1.2.5
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/dist/DripApi.d.ts +4 -1
- package/dist/DripApi.js +42 -11
- package/dist/DripConfig.d.ts +1 -0
- package/dist/DripConfig.js +6 -2
- package/dist/DripSdk.d.ts +7 -0
- package/dist/DripSdk.js +77 -0
- package/dist/contracts/DripSwapAndRecyclerContract.d.ts +7 -0
- package/dist/contracts/DripSwapAndRecyclerContract.js +40 -0
- package/dist/contracts/abi/DripSwapAndRecyclerAbi.json +516 -0
- package/dist/index.d.ts +2 -1
- package/dist/types/BeanEntry.d.ts +12 -0
- package/dist/types/BeanEntry.js +2 -0
- package/package.json +1 -1
package/dist/DripApi.d.ts
CHANGED
@@ -7,8 +7,10 @@ import { VaultStats } from './types/VaultStats';
|
|
7
7
|
import { UserBalance } from './types/UserBalance';
|
8
8
|
import { VaultClaimData } from './types/VaultClaimData';
|
9
9
|
import MyPerqData from './types/MyPerqData';
|
10
|
+
import { LoyaltyCard } from './types/LoyaltyCard';
|
10
11
|
import { BeansBalance } from './types/BeansBalance';
|
11
12
|
import { PerqToBeansSwapInfo } from './types/PerqToBeansSwapInfo';
|
13
|
+
import BeanEntry from './types/BeanEntry';
|
12
14
|
export declare const IMPERSONATOR_HEADER = "impersonatorAddress";
|
13
15
|
export default class DripApi {
|
14
16
|
route: string;
|
@@ -33,7 +35,7 @@ export default class DripApi {
|
|
33
35
|
fetchFastWithdrawNFTs(vaultAddress: string, walletAddress: string, token: string, headers?: Headers): Promise<QLFastRedeem[]>;
|
34
36
|
fetchUserRewards(walletAddress: string, token: string, headers?: Headers): Promise<UserRewards>;
|
35
37
|
fetchVaultsClaimableData(walletAddress: string, token: string, headers?: Headers): Promise<VaultClaimData>;
|
36
|
-
fetchAllLoyaltyCards(): Promise<
|
38
|
+
fetchAllLoyaltyCards(): Promise<LoyaltyCard[]>;
|
37
39
|
fetchOwnedLoyaltyCards(token: string, headers?: Headers): Promise<{
|
38
40
|
id: any;
|
39
41
|
tier: any;
|
@@ -59,4 +61,5 @@ export default class DripApi {
|
|
59
61
|
fetchMyPerqData(userAddress: string, token: string, headers?: Headers): Promise<MyPerqData>;
|
60
62
|
getLoyaltyCardBoost(rewardId: string, token: string, headers?: Headers): Promise<number>;
|
61
63
|
getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
|
64
|
+
fetchBeansHistory(walletAddress: string, token: string, headers?: Headers): Promise<BeanEntry[]>;
|
62
65
|
}
|
package/dist/DripApi.js
CHANGED
@@ -358,18 +358,15 @@ class DripApi {
|
|
358
358
|
}
|
359
359
|
fetchAllLoyaltyCards() {
|
360
360
|
return __awaiter(this, void 0, void 0, function* () {
|
361
|
-
const res = yield fetch(`${this.route}/api-be/api/loyaltyCards`);
|
361
|
+
const res = yield fetch(`${this.route}/api-be/api/loyaltyCards/all`);
|
362
362
|
const data = yield res.json();
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
};
|
371
|
-
});
|
372
|
-
return mappedData;
|
363
|
+
return data.map((card) => ({
|
364
|
+
id: card.id,
|
365
|
+
tier: card.tier,
|
366
|
+
level: card.level,
|
367
|
+
cost: parseFloat(ethers_1.ethers.utils.formatUnits(card.cost.toString(), DripConfig_1.DRIP_TOKEN_DECIMALS)),
|
368
|
+
boost: card.boost
|
369
|
+
}));
|
373
370
|
});
|
374
371
|
}
|
375
372
|
fetchOwnedLoyaltyCards(token, headers) {
|
@@ -493,5 +490,39 @@ class DripApi {
|
|
493
490
|
}
|
494
491
|
});
|
495
492
|
}
|
493
|
+
fetchBeansHistory(walletAddress, token, headers) {
|
494
|
+
return __awaiter(this, void 0, void 0, function* () {
|
495
|
+
const reqHeaders = headers ? headers : new Headers();
|
496
|
+
reqHeaders.append(AUTHORIZATION_HEADER, token);
|
497
|
+
if (reqHeaders.has(exports.IMPERSONATOR_HEADER)) {
|
498
|
+
walletAddress = reqHeaders.get(exports.IMPERSONATOR_HEADER);
|
499
|
+
}
|
500
|
+
const res = yield fetch(`${this.route}/api-be/api/beans/history/${walletAddress}`, {
|
501
|
+
method: 'GET',
|
502
|
+
headers: reqHeaders,
|
503
|
+
});
|
504
|
+
if (res.ok) {
|
505
|
+
const data = yield res.json();
|
506
|
+
const result = data.map((element) => {
|
507
|
+
const newBeanEntry = {
|
508
|
+
address: element.address,
|
509
|
+
reason: element.reason,
|
510
|
+
recycledAmount: element.recycledAmount,
|
511
|
+
beansAmount: element.beansAmount,
|
512
|
+
beansSum: element.beansSum,
|
513
|
+
amountDepositedInUsd: element.amountDepositedInUsd,
|
514
|
+
chainId: element.chainId,
|
515
|
+
nonce: element.nonce,
|
516
|
+
createdAt: element.createdAt
|
517
|
+
};
|
518
|
+
return newBeanEntry;
|
519
|
+
});
|
520
|
+
return result;
|
521
|
+
}
|
522
|
+
else {
|
523
|
+
throw Error(`${yield res.text()}`);
|
524
|
+
}
|
525
|
+
});
|
526
|
+
}
|
496
527
|
}
|
497
528
|
exports.default = DripApi;
|
package/dist/DripConfig.d.ts
CHANGED
@@ -13,6 +13,7 @@ export declare class DripConfig {
|
|
13
13
|
smartVaultManagerAddress: string | undefined;
|
14
14
|
dripTokenAddress: string;
|
15
15
|
dripTokenRecyclerAddress: string;
|
16
|
+
dripSwapAndRecyclerAddress: string;
|
16
17
|
constructor(chain: Chain, dripRoute?: string);
|
17
18
|
getSwapAndDepositContractAddress(signer: Signer): Promise<string>;
|
18
19
|
getSmartVaultManagerAddress(signer: Signer): Promise<string>;
|
package/dist/DripConfig.js
CHANGED
@@ -20,10 +20,12 @@ var Chain;
|
|
20
20
|
})(Chain || (exports.Chain = Chain = {}));
|
21
21
|
const SUBGRAPH_URL_SEPOLIA = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2-sepolia/api';
|
22
22
|
const RECYCLER_ADDRESS_SEPOLIA = '0x07F2264E199D62afe07E8288eC9D36d155fc3f24';
|
23
|
+
const SWAP_AND_RECYCLER_ADDRESS_SEPOLIA = '0xb381F676960a3E534E6cEb27c3290EBA8275cE3b';
|
23
24
|
const DRIP_TOKEN_ADDRESS_SEPOLIA = '0x707B4Cc05645713d8Ea04FBC7192A0f2c1503d6E';
|
24
25
|
const SUBGRAPH_URL_MAINNET = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2/api';
|
25
26
|
// const RECYCLER_ADDRESS_MAINNET = '';
|
26
|
-
// const
|
27
|
+
// const SWAP_AND_RECYCLER_ADDRESS_MAINNET = '0xb381F676960a3E534E6cEb27c3290EBA8275cE3b';
|
28
|
+
const DRIP_TOKEN_ADDRESS_MAINNET = '0x2a414884a549ef5716bc1a4e648d3dc03f08b2cf';
|
27
29
|
const DEV_BACKEND_ROUTE = 'https://dev.drip.fi.io';
|
28
30
|
const PROD_BACKEND_ROUTE = 'https://perq.finance';
|
29
31
|
class DripConfig {
|
@@ -32,14 +34,16 @@ class DripConfig {
|
|
32
34
|
case Chain.MAINNET:
|
33
35
|
this.internalConfig = (0, spool_v2_sdk_1.getMainnetConfig)(SUBGRAPH_URL_MAINNET);
|
34
36
|
this.dripRoute = dripRoute !== undefined ? dripRoute : PROD_BACKEND_ROUTE;
|
35
|
-
this.dripTokenAddress =
|
37
|
+
this.dripTokenAddress = DRIP_TOKEN_ADDRESS_MAINNET;
|
36
38
|
this.dripTokenRecyclerAddress = exports.NULL_ADDRESS;
|
39
|
+
this.dripSwapAndRecyclerAddress = exports.NULL_ADDRESS;
|
37
40
|
break;
|
38
41
|
case Chain.SEPOLIA:
|
39
42
|
this.internalConfig = (0, spool_v2_sdk_1.getSepoliaConfig)(SUBGRAPH_URL_SEPOLIA);
|
40
43
|
this.dripRoute = dripRoute !== undefined ? dripRoute : DEV_BACKEND_ROUTE;
|
41
44
|
this.dripTokenAddress = DRIP_TOKEN_ADDRESS_SEPOLIA;
|
42
45
|
this.dripTokenRecyclerAddress = RECYCLER_ADDRESS_SEPOLIA;
|
46
|
+
this.dripSwapAndRecyclerAddress = SWAP_AND_RECYCLER_ADDRESS_SEPOLIA;
|
43
47
|
break;
|
44
48
|
}
|
45
49
|
}
|
package/dist/DripSdk.d.ts
CHANGED
@@ -11,10 +11,12 @@ import MyPerqData from './types/MyPerqData';
|
|
11
11
|
import { Chain } from './DripConfig';
|
12
12
|
import { BeansBalance } from './types/BeansBalance';
|
13
13
|
import { PerqToBeansSwapInfo } from './types/PerqToBeansSwapInfo';
|
14
|
+
import BeanEntry from './types/BeanEntry';
|
14
15
|
export default class DripSdk {
|
15
16
|
private dripApi;
|
16
17
|
private dripTokenContract;
|
17
18
|
private dripTokenRecyclerContract;
|
19
|
+
private dripSwapAndRecyclerContract;
|
18
20
|
private spoolSdk?;
|
19
21
|
private signer?;
|
20
22
|
private dripConfig;
|
@@ -31,6 +33,7 @@ export default class DripSdk {
|
|
31
33
|
private doDeposit;
|
32
34
|
getTokenAllowanceForCurrency(tokenAddress: string): Promise<string>;
|
33
35
|
getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>;
|
36
|
+
getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>;
|
34
37
|
getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
|
35
38
|
getUserBalance(headers?: Headers): Promise<UserBalance>;
|
36
39
|
getUserBoostedNfts(vaultAddress: string, headers?: Headers): Promise<string[]>;
|
@@ -46,13 +49,17 @@ export default class DripSdk {
|
|
46
49
|
claimWithdraws(vaultAddress: string): Promise<string>;
|
47
50
|
getVaultsClaimableData(headers?: Headers): Promise<VaultClaimData>;
|
48
51
|
getBeansBalance(headers?: Headers): Promise<BeansBalance>;
|
52
|
+
getBeansHistory(headers?: Headers): Promise<BeanEntry[]>;
|
49
53
|
recycleTokens(tokenAddress: string | undefined, amountToRecycle: string, beneficiary: string | undefined, price: string, deadline: string, signature: string): Promise<string>;
|
54
|
+
swapAndRecycleETH(beneficiary: string, path: string[], minAmountOutWithDecimals: string, price: string, deadline: string, signature: string): Promise<string>;
|
55
|
+
swapAndRecycleERC20(beneficiary: string, path: string[], minAmountOutWithDecimals: string, amountInWithDecimals: string, price: string, deadline: string, signature: string): Promise<string>;
|
50
56
|
upgradeLoyaltyCard(): Promise<LoyaltyCard>;
|
51
57
|
getNextLoyaltyCard(headers?: Headers): Promise<LoyaltyCard>;
|
52
58
|
getOwnedLoyaltyCards(headers?: Headers): Promise<LoyaltyCard>;
|
53
59
|
getAllLoyaltyCards(): Promise<LoyaltyCard[]>;
|
54
60
|
getLoyaltyCardBoost(rewardId: string, headers?: Headers): Promise<number>;
|
55
61
|
approveTokenForRecycler(tokenAddress: string, amount: string): Promise<string>;
|
62
|
+
approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string>;
|
56
63
|
approveTokenForSwapAndDeposit(tokenAddress: string, amount: string): Promise<string>;
|
57
64
|
approveTokenForDeposit(tokenAddress: string, amount: string): Promise<string>;
|
58
65
|
getDripTokenContractAddress(): string;
|
package/dist/DripSdk.js
CHANGED
@@ -20,6 +20,7 @@ const DripApi_1 = __importDefault(require("./DripApi"));
|
|
20
20
|
const js_cookie_1 = __importDefault(require("js-cookie"));
|
21
21
|
const DripTokenContract_1 = __importDefault(require("./contracts/DripTokenContract"));
|
22
22
|
const DripTokenRecyclerContract_1 = __importDefault(require("./contracts/DripTokenRecyclerContract"));
|
23
|
+
const DripSwapAndRecyclerContract_1 = __importDefault(require("./contracts/DripSwapAndRecyclerContract"));
|
23
24
|
class DripSdk {
|
24
25
|
constructor(chain, signer, dripRoute) {
|
25
26
|
this.signer = signer;
|
@@ -30,6 +31,7 @@ class DripSdk {
|
|
30
31
|
this.dripApi = new DripApi_1.default(this.dripConfig.dripRoute);
|
31
32
|
this.dripTokenContract = new DripTokenContract_1.default(this.dripConfig.dripTokenAddress, signer);
|
32
33
|
this.dripTokenRecyclerContract = new DripTokenRecyclerContract_1.default(this.dripConfig.dripTokenRecyclerAddress, signer);
|
34
|
+
this.dripSwapAndRecyclerContract = new DripSwapAndRecyclerContract_1.default(this.dripConfig.dripSwapAndRecyclerAddress, signer);
|
33
35
|
}
|
34
36
|
getAllVaults() {
|
35
37
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -164,6 +166,15 @@ class DripSdk {
|
|
164
166
|
return allowance;
|
165
167
|
});
|
166
168
|
}
|
169
|
+
getTokenAllowanceForSwapAndRecycler(tokenAddress) {
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
171
|
+
if (!this.signer) {
|
172
|
+
throw Error('No signer provided');
|
173
|
+
}
|
174
|
+
const allowance = yield this.getERC20TokenAllowance(this.dripSwapAndRecyclerContract.getContractAddress(), tokenAddress);
|
175
|
+
return allowance;
|
176
|
+
});
|
177
|
+
}
|
167
178
|
getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals) {
|
168
179
|
return __awaiter(this, void 0, void 0, function* () {
|
169
180
|
const userAddress = yield this.signer.getAddress();
|
@@ -362,6 +373,15 @@ class DripSdk {
|
|
362
373
|
return this.dripApi.fetchBeansBalance(authData.token, headers);
|
363
374
|
});
|
364
375
|
}
|
376
|
+
getBeansHistory(headers) {
|
377
|
+
return __awaiter(this, void 0, void 0, function* () {
|
378
|
+
const authData = yield this.isUserAuthenticated();
|
379
|
+
if (!authData.isAuthenticated) {
|
380
|
+
throw Error(`User not authenticated: ${authData.message}`);
|
381
|
+
}
|
382
|
+
return this.dripApi.fetchBeansHistory(authData.address, authData.token, headers);
|
383
|
+
});
|
384
|
+
}
|
365
385
|
recycleTokens() {
|
366
386
|
return __awaiter(this, arguments, void 0, function* (tokenAddress = this.dripConfig.dripTokenAddress, amountToRecycle, beneficiary = DripConfig_1.NULL_ADDRESS, price, deadline, signature) {
|
367
387
|
const authData = yield this.isUserAuthenticated();
|
@@ -378,6 +398,52 @@ class DripSdk {
|
|
378
398
|
return receipt.transactionHash;
|
379
399
|
});
|
380
400
|
}
|
401
|
+
swapAndRecycleETH(beneficiary, path, minAmountOutWithDecimals, price, deadline, signature) {
|
402
|
+
return __awaiter(this, void 0, void 0, function* () {
|
403
|
+
const authData = yield this.isUserAuthenticated();
|
404
|
+
if (!authData.isAuthenticated) {
|
405
|
+
throw Error(`User not authenticated: ${authData.message}`);
|
406
|
+
}
|
407
|
+
if (this.dripConfig.dripSwapAndRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
|
408
|
+
throw Error('Recycler contract address not defined');
|
409
|
+
}
|
410
|
+
console.log("swap and recycle ETH with this: ", {
|
411
|
+
beneficiary,
|
412
|
+
path,
|
413
|
+
minAmountOutWithDecimals,
|
414
|
+
price,
|
415
|
+
deadline,
|
416
|
+
signature
|
417
|
+
});
|
418
|
+
//! IF ETH => first option in path needs to be WETH, so add WETH to index[0] to the path array
|
419
|
+
const swapAndRecycleTx = yield this.dripSwapAndRecyclerContract.swapETHAndRecycle(beneficiary, path, minAmountOutWithDecimals, price, deadline, signature);
|
420
|
+
const receipt = yield swapAndRecycleTx.wait();
|
421
|
+
return receipt.transactionHash;
|
422
|
+
});
|
423
|
+
}
|
424
|
+
swapAndRecycleERC20(beneficiary, path, minAmountOutWithDecimals, amountInWithDecimals, price, deadline, signature) {
|
425
|
+
return __awaiter(this, void 0, void 0, function* () {
|
426
|
+
const authData = yield this.isUserAuthenticated();
|
427
|
+
if (!authData.isAuthenticated) {
|
428
|
+
throw Error(`User not authenticated: ${authData.message}`);
|
429
|
+
}
|
430
|
+
if (this.dripConfig.dripSwapAndRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
|
431
|
+
throw Error('Recycler contract address not defined');
|
432
|
+
}
|
433
|
+
console.log("swap and recycle ERC-20 with this: ", {
|
434
|
+
beneficiary,
|
435
|
+
path,
|
436
|
+
amountInWithDecimals,
|
437
|
+
minAmountOutWithDecimals,
|
438
|
+
price,
|
439
|
+
deadline,
|
440
|
+
signature
|
441
|
+
});
|
442
|
+
const swapAndRecycleTx = yield this.dripSwapAndRecyclerContract.swapAndRecycle(beneficiary, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature);
|
443
|
+
const receipt = yield swapAndRecycleTx.wait();
|
444
|
+
return receipt.transactionHash;
|
445
|
+
});
|
446
|
+
}
|
381
447
|
upgradeLoyaltyCard() {
|
382
448
|
return __awaiter(this, void 0, void 0, function* () {
|
383
449
|
const authData = yield this.isUserAuthenticated();
|
@@ -430,6 +496,17 @@ class DripSdk {
|
|
430
496
|
return yield this.approveToken(tokenAddress, amount, this.dripConfig.dripTokenRecyclerAddress);
|
431
497
|
});
|
432
498
|
}
|
499
|
+
approveTokenForSwapAndRecycler(tokenAddress, amount) {
|
500
|
+
return __awaiter(this, void 0, void 0, function* () {
|
501
|
+
if (!this.signer) {
|
502
|
+
throw Error('No signer provided');
|
503
|
+
}
|
504
|
+
if (this.dripConfig.dripSwapAndRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
|
505
|
+
throw Error('Recycler contract address not defined');
|
506
|
+
}
|
507
|
+
return yield this.approveToken(tokenAddress, amount, this.dripConfig.dripSwapAndRecyclerAddress);
|
508
|
+
});
|
509
|
+
}
|
433
510
|
approveTokenForSwapAndDeposit(tokenAddress, amount) {
|
434
511
|
return __awaiter(this, void 0, void 0, function* () {
|
435
512
|
if (!this.signer) {
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { ContractTransaction, ethers } from 'ethers';
|
2
|
+
import BaseDripContract from './BaseDripContract';
|
3
|
+
export default class DripSwapAndRecyclerContract extends BaseDripContract {
|
4
|
+
constructor(address: string, signer?: ethers.Signer);
|
5
|
+
swapAndRecycle(beneficiary: string | undefined, path: string[], amountInWithDecimals: string, minAmountOutWithDecimals: string, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
|
6
|
+
swapETHAndRecycle(beneficiary: string | undefined, path: string[], minAmountOutWithDecimals: string, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
|
7
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const ethers_1 = require("ethers");
|
16
|
+
const DripSwapAndRecyclerAbi_json_1 = __importDefault(require("./abi/DripSwapAndRecyclerAbi.json"));
|
17
|
+
const BaseDripContract_1 = __importDefault(require("./BaseDripContract"));
|
18
|
+
const DripConfig_1 = require("../DripConfig");
|
19
|
+
class DripSwapAndRecyclerContract extends BaseDripContract_1.default {
|
20
|
+
constructor(address, signer) {
|
21
|
+
super(address, new ethers_1.ethers.utils.Interface(DripSwapAndRecyclerAbi_json_1.default), signer);
|
22
|
+
}
|
23
|
+
swapAndRecycle() {
|
24
|
+
return __awaiter(this, arguments, void 0, function* (beneficiary = DripConfig_1.NULL_ADDRESS, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature) {
|
25
|
+
if (!this.contract.signer) {
|
26
|
+
throw Error('No signer provided');
|
27
|
+
}
|
28
|
+
return yield this.contract.swapAndRecycle(beneficiary, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature);
|
29
|
+
});
|
30
|
+
}
|
31
|
+
swapETHAndRecycle() {
|
32
|
+
return __awaiter(this, arguments, void 0, function* (beneficiary = DripConfig_1.NULL_ADDRESS, path, minAmountOutWithDecimals, price, deadline, signature) {
|
33
|
+
if (!this.contract.signer) {
|
34
|
+
throw Error('No signer provided');
|
35
|
+
}
|
36
|
+
return yield this.contract.swapETHAndRecycle(beneficiary, path, minAmountOutWithDecimals, price, deadline, signature);
|
37
|
+
});
|
38
|
+
}
|
39
|
+
}
|
40
|
+
exports.default = DripSwapAndRecyclerContract;
|
@@ -0,0 +1,516 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"inputs": [
|
4
|
+
{
|
5
|
+
"internalType": "contract IUniswapV2Router02",
|
6
|
+
"name": "swapRouter_",
|
7
|
+
"type": "address"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"internalType": "contract ITokenRecycler",
|
11
|
+
"name": "tokenRecycler_",
|
12
|
+
"type": "address"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"internalType": "address",
|
16
|
+
"name": "admin_",
|
17
|
+
"type": "address"
|
18
|
+
}
|
19
|
+
],
|
20
|
+
"stateMutability": "nonpayable",
|
21
|
+
"type": "constructor"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"inputs": [],
|
25
|
+
"name": "AccessControlBadConfirmation",
|
26
|
+
"type": "error"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"inputs": [
|
30
|
+
{
|
31
|
+
"internalType": "address",
|
32
|
+
"name": "account",
|
33
|
+
"type": "address"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"internalType": "bytes32",
|
37
|
+
"name": "neededRole",
|
38
|
+
"type": "bytes32"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"name": "AccessControlUnauthorizedAccount",
|
42
|
+
"type": "error"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"inputs": [
|
46
|
+
{
|
47
|
+
"internalType": "address",
|
48
|
+
"name": "target",
|
49
|
+
"type": "address"
|
50
|
+
}
|
51
|
+
],
|
52
|
+
"name": "AddressEmptyCode",
|
53
|
+
"type": "error"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"inputs": [
|
57
|
+
{
|
58
|
+
"internalType": "address",
|
59
|
+
"name": "account",
|
60
|
+
"type": "address"
|
61
|
+
}
|
62
|
+
],
|
63
|
+
"name": "AddressInsufficientBalance",
|
64
|
+
"type": "error"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"inputs": [],
|
68
|
+
"name": "FailedInnerCall",
|
69
|
+
"type": "error"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"inputs": [],
|
73
|
+
"name": "ReentrancyGuardReentrantCall",
|
74
|
+
"type": "error"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"inputs": [
|
78
|
+
{
|
79
|
+
"internalType": "address",
|
80
|
+
"name": "token",
|
81
|
+
"type": "address"
|
82
|
+
}
|
83
|
+
],
|
84
|
+
"name": "SafeERC20FailedOperation",
|
85
|
+
"type": "error"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"anonymous": false,
|
89
|
+
"inputs": [
|
90
|
+
{
|
91
|
+
"indexed": true,
|
92
|
+
"internalType": "bytes32",
|
93
|
+
"name": "role",
|
94
|
+
"type": "bytes32"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"indexed": true,
|
98
|
+
"internalType": "bytes32",
|
99
|
+
"name": "previousAdminRole",
|
100
|
+
"type": "bytes32"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"indexed": true,
|
104
|
+
"internalType": "bytes32",
|
105
|
+
"name": "newAdminRole",
|
106
|
+
"type": "bytes32"
|
107
|
+
}
|
108
|
+
],
|
109
|
+
"name": "RoleAdminChanged",
|
110
|
+
"type": "event"
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"anonymous": false,
|
114
|
+
"inputs": [
|
115
|
+
{
|
116
|
+
"indexed": true,
|
117
|
+
"internalType": "bytes32",
|
118
|
+
"name": "role",
|
119
|
+
"type": "bytes32"
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"indexed": true,
|
123
|
+
"internalType": "address",
|
124
|
+
"name": "account",
|
125
|
+
"type": "address"
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"indexed": true,
|
129
|
+
"internalType": "address",
|
130
|
+
"name": "sender",
|
131
|
+
"type": "address"
|
132
|
+
}
|
133
|
+
],
|
134
|
+
"name": "RoleGranted",
|
135
|
+
"type": "event"
|
136
|
+
},
|
137
|
+
{
|
138
|
+
"anonymous": false,
|
139
|
+
"inputs": [
|
140
|
+
{
|
141
|
+
"indexed": true,
|
142
|
+
"internalType": "bytes32",
|
143
|
+
"name": "role",
|
144
|
+
"type": "bytes32"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"indexed": true,
|
148
|
+
"internalType": "address",
|
149
|
+
"name": "account",
|
150
|
+
"type": "address"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"indexed": true,
|
154
|
+
"internalType": "address",
|
155
|
+
"name": "sender",
|
156
|
+
"type": "address"
|
157
|
+
}
|
158
|
+
],
|
159
|
+
"name": "RoleRevoked",
|
160
|
+
"type": "event"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"anonymous": false,
|
164
|
+
"inputs": [
|
165
|
+
{
|
166
|
+
"indexed": true,
|
167
|
+
"internalType": "address",
|
168
|
+
"name": "sender",
|
169
|
+
"type": "address"
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"indexed": true,
|
173
|
+
"internalType": "address",
|
174
|
+
"name": "rewardBeneficiary",
|
175
|
+
"type": "address"
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"indexed": false,
|
179
|
+
"internalType": "address[]",
|
180
|
+
"name": "path",
|
181
|
+
"type": "address[]"
|
182
|
+
},
|
183
|
+
{
|
184
|
+
"indexed": false,
|
185
|
+
"internalType": "uint256[]",
|
186
|
+
"name": "swapAmounts",
|
187
|
+
"type": "uint256[]"
|
188
|
+
},
|
189
|
+
{
|
190
|
+
"indexed": false,
|
191
|
+
"internalType": "uint256",
|
192
|
+
"name": "minAmountOut",
|
193
|
+
"type": "uint256"
|
194
|
+
},
|
195
|
+
{
|
196
|
+
"indexed": false,
|
197
|
+
"internalType": "uint256",
|
198
|
+
"name": "deadline",
|
199
|
+
"type": "uint256"
|
200
|
+
},
|
201
|
+
{
|
202
|
+
"indexed": false,
|
203
|
+
"internalType": "uint256",
|
204
|
+
"name": "rewardAmount",
|
205
|
+
"type": "uint256"
|
206
|
+
}
|
207
|
+
],
|
208
|
+
"name": "SwappedAndRecycled",
|
209
|
+
"type": "event"
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"inputs": [],
|
213
|
+
"name": "ADMIN_ROLE",
|
214
|
+
"outputs": [
|
215
|
+
{
|
216
|
+
"internalType": "bytes32",
|
217
|
+
"name": "",
|
218
|
+
"type": "bytes32"
|
219
|
+
}
|
220
|
+
],
|
221
|
+
"stateMutability": "view",
|
222
|
+
"type": "function"
|
223
|
+
},
|
224
|
+
{
|
225
|
+
"inputs": [],
|
226
|
+
"name": "DEFAULT_ADMIN_ROLE",
|
227
|
+
"outputs": [
|
228
|
+
{
|
229
|
+
"internalType": "bytes32",
|
230
|
+
"name": "",
|
231
|
+
"type": "bytes32"
|
232
|
+
}
|
233
|
+
],
|
234
|
+
"stateMutability": "view",
|
235
|
+
"type": "function"
|
236
|
+
},
|
237
|
+
{
|
238
|
+
"inputs": [
|
239
|
+
{
|
240
|
+
"internalType": "bytes32",
|
241
|
+
"name": "role",
|
242
|
+
"type": "bytes32"
|
243
|
+
}
|
244
|
+
],
|
245
|
+
"name": "getRoleAdmin",
|
246
|
+
"outputs": [
|
247
|
+
{
|
248
|
+
"internalType": "bytes32",
|
249
|
+
"name": "",
|
250
|
+
"type": "bytes32"
|
251
|
+
}
|
252
|
+
],
|
253
|
+
"stateMutability": "view",
|
254
|
+
"type": "function"
|
255
|
+
},
|
256
|
+
{
|
257
|
+
"inputs": [
|
258
|
+
{
|
259
|
+
"internalType": "bytes32",
|
260
|
+
"name": "role",
|
261
|
+
"type": "bytes32"
|
262
|
+
},
|
263
|
+
{
|
264
|
+
"internalType": "address",
|
265
|
+
"name": "account",
|
266
|
+
"type": "address"
|
267
|
+
}
|
268
|
+
],
|
269
|
+
"name": "grantRole",
|
270
|
+
"outputs": [],
|
271
|
+
"stateMutability": "nonpayable",
|
272
|
+
"type": "function"
|
273
|
+
},
|
274
|
+
{
|
275
|
+
"inputs": [
|
276
|
+
{
|
277
|
+
"internalType": "bytes32",
|
278
|
+
"name": "role",
|
279
|
+
"type": "bytes32"
|
280
|
+
},
|
281
|
+
{
|
282
|
+
"internalType": "address",
|
283
|
+
"name": "account",
|
284
|
+
"type": "address"
|
285
|
+
}
|
286
|
+
],
|
287
|
+
"name": "hasRole",
|
288
|
+
"outputs": [
|
289
|
+
{
|
290
|
+
"internalType": "bool",
|
291
|
+
"name": "",
|
292
|
+
"type": "bool"
|
293
|
+
}
|
294
|
+
],
|
295
|
+
"stateMutability": "view",
|
296
|
+
"type": "function"
|
297
|
+
},
|
298
|
+
{
|
299
|
+
"inputs": [],
|
300
|
+
"name": "recycledToken",
|
301
|
+
"outputs": [
|
302
|
+
{
|
303
|
+
"internalType": "contract IERC20",
|
304
|
+
"name": "",
|
305
|
+
"type": "address"
|
306
|
+
}
|
307
|
+
],
|
308
|
+
"stateMutability": "view",
|
309
|
+
"type": "function"
|
310
|
+
},
|
311
|
+
{
|
312
|
+
"inputs": [
|
313
|
+
{
|
314
|
+
"internalType": "bytes32",
|
315
|
+
"name": "role",
|
316
|
+
"type": "bytes32"
|
317
|
+
},
|
318
|
+
{
|
319
|
+
"internalType": "address",
|
320
|
+
"name": "callerConfirmation",
|
321
|
+
"type": "address"
|
322
|
+
}
|
323
|
+
],
|
324
|
+
"name": "renounceRole",
|
325
|
+
"outputs": [],
|
326
|
+
"stateMutability": "nonpayable",
|
327
|
+
"type": "function"
|
328
|
+
},
|
329
|
+
{
|
330
|
+
"inputs": [
|
331
|
+
{
|
332
|
+
"internalType": "bytes32",
|
333
|
+
"name": "role",
|
334
|
+
"type": "bytes32"
|
335
|
+
},
|
336
|
+
{
|
337
|
+
"internalType": "address",
|
338
|
+
"name": "account",
|
339
|
+
"type": "address"
|
340
|
+
}
|
341
|
+
],
|
342
|
+
"name": "revokeRole",
|
343
|
+
"outputs": [],
|
344
|
+
"stateMutability": "nonpayable",
|
345
|
+
"type": "function"
|
346
|
+
},
|
347
|
+
{
|
348
|
+
"inputs": [
|
349
|
+
{
|
350
|
+
"internalType": "bytes4",
|
351
|
+
"name": "interfaceId",
|
352
|
+
"type": "bytes4"
|
353
|
+
}
|
354
|
+
],
|
355
|
+
"name": "supportsInterface",
|
356
|
+
"outputs": [
|
357
|
+
{
|
358
|
+
"internalType": "bool",
|
359
|
+
"name": "",
|
360
|
+
"type": "bool"
|
361
|
+
}
|
362
|
+
],
|
363
|
+
"stateMutability": "view",
|
364
|
+
"type": "function"
|
365
|
+
},
|
366
|
+
{
|
367
|
+
"inputs": [
|
368
|
+
{
|
369
|
+
"internalType": "address",
|
370
|
+
"name": "rewardBeneficiary_",
|
371
|
+
"type": "address"
|
372
|
+
},
|
373
|
+
{
|
374
|
+
"internalType": "address[]",
|
375
|
+
"name": "path_",
|
376
|
+
"type": "address[]"
|
377
|
+
},
|
378
|
+
{
|
379
|
+
"internalType": "uint256",
|
380
|
+
"name": "amountIn_",
|
381
|
+
"type": "uint256"
|
382
|
+
},
|
383
|
+
{
|
384
|
+
"internalType": "uint256",
|
385
|
+
"name": "minAmountOut_",
|
386
|
+
"type": "uint256"
|
387
|
+
},
|
388
|
+
{
|
389
|
+
"internalType": "uint256",
|
390
|
+
"name": "price_",
|
391
|
+
"type": "uint256"
|
392
|
+
},
|
393
|
+
{
|
394
|
+
"internalType": "uint256",
|
395
|
+
"name": "deadline_",
|
396
|
+
"type": "uint256"
|
397
|
+
},
|
398
|
+
{
|
399
|
+
"internalType": "bytes",
|
400
|
+
"name": "signature_",
|
401
|
+
"type": "bytes"
|
402
|
+
}
|
403
|
+
],
|
404
|
+
"name": "swapAndRecycle",
|
405
|
+
"outputs": [
|
406
|
+
{
|
407
|
+
"internalType": "uint256",
|
408
|
+
"name": "",
|
409
|
+
"type": "uint256"
|
410
|
+
}
|
411
|
+
],
|
412
|
+
"stateMutability": "nonpayable",
|
413
|
+
"type": "function"
|
414
|
+
},
|
415
|
+
{
|
416
|
+
"inputs": [
|
417
|
+
{
|
418
|
+
"internalType": "address",
|
419
|
+
"name": "rewardBeneficiary_",
|
420
|
+
"type": "address"
|
421
|
+
},
|
422
|
+
{
|
423
|
+
"internalType": "address[]",
|
424
|
+
"name": "path_",
|
425
|
+
"type": "address[]"
|
426
|
+
},
|
427
|
+
{
|
428
|
+
"internalType": "uint256",
|
429
|
+
"name": "minAmountOut_",
|
430
|
+
"type": "uint256"
|
431
|
+
},
|
432
|
+
{
|
433
|
+
"internalType": "uint256",
|
434
|
+
"name": "price_",
|
435
|
+
"type": "uint256"
|
436
|
+
},
|
437
|
+
{
|
438
|
+
"internalType": "uint256",
|
439
|
+
"name": "deadline_",
|
440
|
+
"type": "uint256"
|
441
|
+
},
|
442
|
+
{
|
443
|
+
"internalType": "bytes",
|
444
|
+
"name": "signature_",
|
445
|
+
"type": "bytes"
|
446
|
+
}
|
447
|
+
],
|
448
|
+
"name": "swapETHAndRecycle",
|
449
|
+
"outputs": [
|
450
|
+
{
|
451
|
+
"internalType": "uint256",
|
452
|
+
"name": "",
|
453
|
+
"type": "uint256"
|
454
|
+
}
|
455
|
+
],
|
456
|
+
"stateMutability": "payable",
|
457
|
+
"type": "function"
|
458
|
+
},
|
459
|
+
{
|
460
|
+
"inputs": [],
|
461
|
+
"name": "swapRouter",
|
462
|
+
"outputs": [
|
463
|
+
{
|
464
|
+
"internalType": "contract IUniswapV2Router02",
|
465
|
+
"name": "",
|
466
|
+
"type": "address"
|
467
|
+
}
|
468
|
+
],
|
469
|
+
"stateMutability": "view",
|
470
|
+
"type": "function"
|
471
|
+
},
|
472
|
+
{
|
473
|
+
"inputs": [],
|
474
|
+
"name": "tokenRecycler",
|
475
|
+
"outputs": [
|
476
|
+
{
|
477
|
+
"internalType": "contract ITokenRecycler",
|
478
|
+
"name": "",
|
479
|
+
"type": "address"
|
480
|
+
}
|
481
|
+
],
|
482
|
+
"stateMutability": "view",
|
483
|
+
"type": "function"
|
484
|
+
},
|
485
|
+
{
|
486
|
+
"inputs": [
|
487
|
+
{
|
488
|
+
"internalType": "uint256",
|
489
|
+
"name": "amount_",
|
490
|
+
"type": "uint256"
|
491
|
+
}
|
492
|
+
],
|
493
|
+
"name": "withdrawETH",
|
494
|
+
"outputs": [],
|
495
|
+
"stateMutability": "nonpayable",
|
496
|
+
"type": "function"
|
497
|
+
},
|
498
|
+
{
|
499
|
+
"inputs": [
|
500
|
+
{
|
501
|
+
"internalType": "contract IERC20",
|
502
|
+
"name": "token_",
|
503
|
+
"type": "address"
|
504
|
+
},
|
505
|
+
{
|
506
|
+
"internalType": "uint256",
|
507
|
+
"name": "amount_",
|
508
|
+
"type": "uint256"
|
509
|
+
}
|
510
|
+
],
|
511
|
+
"name": "withdrawToken",
|
512
|
+
"outputs": [],
|
513
|
+
"stateMutability": "nonpayable",
|
514
|
+
"type": "function"
|
515
|
+
}
|
516
|
+
]
|
package/dist/index.d.ts
CHANGED
@@ -14,4 +14,5 @@ import { VaultStats } from './types/VaultStats';
|
|
14
14
|
import { Chain } from './DripConfig';
|
15
15
|
import MyPerqData from './types/MyPerqData';
|
16
16
|
import ELoyaltyCardTier from './types/ELoyaltyCardTier';
|
17
|
-
|
17
|
+
import BeanEntry from './types/BeanEntry';
|
18
|
+
export { Vault, VaultReward, DripSdk, UserVaultBalance, UserBalance, VaultStats, AuthenticationStatus, NFTBoost, Strategy, StretchGoal, SwapInfo, VaultDepositToken, VaultType, MyPerqData, Chain, ELoyaltyCardTier, BeanEntry };
|