@dripfi/drip-sdk 1.2.5 → 1.2.7
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/DripConfig.js
CHANGED
@@ -20,11 +20,11 @@ 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 = '
|
23
|
+
const SWAP_AND_RECYCLER_ADDRESS_SEPOLIA = '0xA4ed357FF233731860Ec8D0446FD95756d564014';
|
24
24
|
const DRIP_TOKEN_ADDRESS_SEPOLIA = '0x707B4Cc05645713d8Ea04FBC7192A0f2c1503d6E';
|
25
25
|
const SUBGRAPH_URL_MAINNET = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2/api';
|
26
26
|
// const RECYCLER_ADDRESS_MAINNET = '';
|
27
|
-
// const SWAP_AND_RECYCLER_ADDRESS_MAINNET = '
|
27
|
+
// const SWAP_AND_RECYCLER_ADDRESS_MAINNET = '0xA4ed357FF233731860Ec8D0446FD95756d564014';
|
28
28
|
const DRIP_TOKEN_ADDRESS_MAINNET = '0x2a414884a549ef5716bc1a4e648d3dc03f08b2cf';
|
29
29
|
const DEV_BACKEND_ROUTE = 'https://dev.drip.fi.io';
|
30
30
|
const PROD_BACKEND_ROUTE = 'https://perq.finance';
|
package/dist/DripSdk.d.ts
CHANGED
@@ -51,7 +51,7 @@ export default class DripSdk {
|
|
51
51
|
getBeansBalance(headers?: Headers): Promise<BeansBalance>;
|
52
52
|
getBeansHistory(headers?: Headers): Promise<BeanEntry[]>;
|
53
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>;
|
54
|
+
swapAndRecycleETH(beneficiary: string, path: string[], minAmountOutWithDecimals: string, amountOfEth: string, price: string, deadline: string, signature: string): Promise<string>;
|
55
55
|
swapAndRecycleERC20(beneficiary: string, path: string[], minAmountOutWithDecimals: string, amountInWithDecimals: string, price: string, deadline: string, signature: string): Promise<string>;
|
56
56
|
upgradeLoyaltyCard(): Promise<LoyaltyCard>;
|
57
57
|
getNextLoyaltyCard(headers?: Headers): Promise<LoyaltyCard>;
|
@@ -64,6 +64,7 @@ export default class DripSdk {
|
|
64
64
|
approveTokenForDeposit(tokenAddress: string, amount: string): Promise<string>;
|
65
65
|
getDripTokenContractAddress(): string;
|
66
66
|
getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
|
67
|
+
transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string>;
|
67
68
|
private generateRedeemBagStruct;
|
68
69
|
private getERC20Precission;
|
69
70
|
private calculatePendingDeposits;
|
package/dist/DripSdk.js
CHANGED
@@ -398,7 +398,7 @@ class DripSdk {
|
|
398
398
|
return receipt.transactionHash;
|
399
399
|
});
|
400
400
|
}
|
401
|
-
swapAndRecycleETH(beneficiary, path, minAmountOutWithDecimals, price, deadline, signature) {
|
401
|
+
swapAndRecycleETH(beneficiary, path, minAmountOutWithDecimals, amountOfEth, price, deadline, signature) {
|
402
402
|
return __awaiter(this, void 0, void 0, function* () {
|
403
403
|
const authData = yield this.isUserAuthenticated();
|
404
404
|
if (!authData.isAuthenticated) {
|
@@ -407,16 +407,7 @@ class DripSdk {
|
|
407
407
|
if (this.dripConfig.dripSwapAndRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
|
408
408
|
throw Error('Recycler contract address not defined');
|
409
409
|
}
|
410
|
-
|
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);
|
410
|
+
const swapAndRecycleTx = yield this.dripSwapAndRecyclerContract.swapETHAndRecycle(beneficiary, path, minAmountOutWithDecimals, amountOfEth, price, deadline, signature);
|
420
411
|
const receipt = yield swapAndRecycleTx.wait();
|
421
412
|
return receipt.transactionHash;
|
422
413
|
});
|
@@ -533,6 +524,18 @@ class DripSdk {
|
|
533
524
|
return this.dripApi.getSwapPerqForBeansInfo();
|
534
525
|
});
|
535
526
|
}
|
527
|
+
transferErc20Token(tokenAddress, amount, receiver) {
|
528
|
+
return __awaiter(this, void 0, void 0, function* () {
|
529
|
+
if (!this.signer) {
|
530
|
+
throw Error('No signer provided');
|
531
|
+
}
|
532
|
+
const decimals = yield this.getERC20Precission(tokenAddress);
|
533
|
+
const erc20Instance = spool_v2_sdk_1.ERC20__factory.connect(tokenAddress, this.signer);
|
534
|
+
const approveTx = yield erc20Instance.transfer(receiver, ethers_1.ethers.utils.parseUnits(amount, decimals));
|
535
|
+
const receipt = yield approveTx.wait();
|
536
|
+
return receipt.transactionHash;
|
537
|
+
});
|
538
|
+
}
|
536
539
|
generateRedeemBagStruct(vault, signerAddress, amountToWithdraw) {
|
537
540
|
return __awaiter(this, void 0, void 0, function* () {
|
538
541
|
if (!this.spoolSdk) {
|
@@ -3,5 +3,5 @@ import BaseDripContract from './BaseDripContract';
|
|
3
3
|
export default class DripSwapAndRecyclerContract extends BaseDripContract {
|
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
|
-
swapETHAndRecycle(beneficiary: string | undefined, path: string[], minAmountOutWithDecimals: string, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
|
6
|
+
swapETHAndRecycle(beneficiary: string | undefined, path: string[], minAmountOutWithDecimals: string, amountInEth: string, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
|
7
7
|
}
|
@@ -29,11 +29,13 @@ class DripSwapAndRecyclerContract extends BaseDripContract_1.default {
|
|
29
29
|
});
|
30
30
|
}
|
31
31
|
swapETHAndRecycle() {
|
32
|
-
return __awaiter(this, arguments, void 0, function* (beneficiary = DripConfig_1.NULL_ADDRESS, path, minAmountOutWithDecimals, price, deadline, signature) {
|
32
|
+
return __awaiter(this, arguments, void 0, function* (beneficiary = DripConfig_1.NULL_ADDRESS, path, minAmountOutWithDecimals, amountInEth, price, deadline, signature) {
|
33
33
|
if (!this.contract.signer) {
|
34
34
|
throw Error('No signer provided');
|
35
35
|
}
|
36
|
-
return yield this.contract.swapETHAndRecycle(beneficiary, path, minAmountOutWithDecimals, price, deadline, signature
|
36
|
+
return yield this.contract.swapETHAndRecycle(beneficiary, path, minAmountOutWithDecimals, price, deadline, signature, {
|
37
|
+
value: amountInEth
|
38
|
+
});
|
37
39
|
});
|
38
40
|
}
|
39
41
|
}
|