@dripfi/drip-sdk 1.4.6 → 1.4.8
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/dist/PerqApi.js +3 -2
- package/dist/PerqSdk.d.ts +1 -0
- package/dist/PerqSdk.js +8 -10
- package/dist/types/PerqConfig.d.ts +1 -0
- package/dist/types/PerqConfig.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -90,3 +90,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
90
90
|
### Changed
|
91
91
|
|
92
92
|
- Upgraded version of `SpoolSDK` to `2.0.53` in order to fix potential issues with the generation of the redeem bag structure
|
93
|
+
|
94
|
+
## [1.4.7] - 2025-02-13
|
95
|
+
|
96
|
+
### Added
|
97
|
+
|
98
|
+
- Added method `getSwapAndDepositTokenAllowanceForCurrency` to the `PerqSdk`
|
99
|
+
|
100
|
+
## [1.4.8] - 2025-02-14
|
101
|
+
|
102
|
+
### Changed
|
103
|
+
|
104
|
+
- Updated `PerqApi` to use the new 1inch API endpoint
|
package/dist/PerqApi.js
CHANGED
@@ -88,14 +88,15 @@ class PerqApi {
|
|
88
88
|
if (fromTokenAddress === toTokenAddress && fromTokenAddress === WETH_TOKEN_ADDRESS) {
|
89
89
|
return [];
|
90
90
|
}
|
91
|
-
|
91
|
+
//TODO: Replace the /1/ in this string with dynamic chainId
|
92
|
+
const url = `${this.route}/oneinch?getRequest=/swap/v6.0/1/swap?fromTokenAddress=${fromTokenAddress}%26toTokenAddress=${toTokenAddress}%26amount=${amount.toString()}%26fromAddress=${fromAddress}%26slippage=0.1%26disableEstimate=true%26allowPartialFill=false%26includeTokensInfo=true`;
|
92
93
|
const res = await fetch(url);
|
93
94
|
if (res.ok) {
|
94
95
|
const data = (await res.json());
|
95
96
|
return [
|
96
97
|
{
|
97
98
|
swapTarget: data.tx.to,
|
98
|
-
token: data.
|
99
|
+
token: data.srcToken.address,
|
99
100
|
swapCallData: data.tx.data,
|
100
101
|
},
|
101
102
|
];
|
package/dist/PerqSdk.d.ts
CHANGED
@@ -20,6 +20,7 @@ export default class PerqSdk {
|
|
20
20
|
deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>;
|
21
21
|
private doDeposit;
|
22
22
|
getTokenAllowanceForCurrency(tokenAddress: string): Promise<string>;
|
23
|
+
getSwapAndDepositTokenAllowanceForCurrency(tokenAddress: string): Promise<string>;
|
23
24
|
getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>;
|
24
25
|
getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>;
|
25
26
|
getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
|
package/dist/PerqSdk.js
CHANGED
@@ -91,6 +91,13 @@ class PerqSdk {
|
|
91
91
|
const currentTokenAllowance = await this.getTokenAllowanceForDeposit(tokenAddress);
|
92
92
|
return currentTokenAllowance.toString();
|
93
93
|
}
|
94
|
+
async getSwapAndDepositTokenAllowanceForCurrency(tokenAddress) {
|
95
|
+
if (!this.signer) {
|
96
|
+
throw Error('No signer provided');
|
97
|
+
}
|
98
|
+
const currentTokenAllowance = await this.getTokenAllowanceForSwapAndDeposit(tokenAddress);
|
99
|
+
return currentTokenAllowance.toString();
|
100
|
+
}
|
94
101
|
async getTokenAllowanceForRecycler(tokenAddress) {
|
95
102
|
if (!this.signer) {
|
96
103
|
throw Error('No signer provided');
|
@@ -203,7 +210,7 @@ class PerqSdk {
|
|
203
210
|
}
|
204
211
|
}
|
205
212
|
const fromToken = ethers_1.ethers.utils.parseUnits(amountWithDecimals.toString(), decimals);
|
206
|
-
const swapInfo = await this.perqApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken,
|
213
|
+
const swapInfo = await this.perqApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken, this.perqConfig.swapperAddress);
|
207
214
|
const swapDepositBagStruct = {
|
208
215
|
inTokens: [fromTokenAddress],
|
209
216
|
inAmounts: [fromToken],
|
@@ -280,15 +287,6 @@ class PerqSdk {
|
|
280
287
|
if (this.perqConfig.perqSwapAndRecyclerAddress === ethers_1.ethers.constants.AddressZero) {
|
281
288
|
throw Error('Recycler contract address not defined');
|
282
289
|
}
|
283
|
-
console.log('swap and recycle ERC-20 with this: ', {
|
284
|
-
beneficiary,
|
285
|
-
path,
|
286
|
-
amountInWithDecimals,
|
287
|
-
minAmountOutWithDecimals,
|
288
|
-
price,
|
289
|
-
deadline,
|
290
|
-
signature,
|
291
|
-
});
|
292
290
|
const swapAndRecycleTx = await this.perqSwapAndRecyclerContract.swapAndRecycle(beneficiary, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature);
|
293
291
|
const receipt = await swapAndRecycleTx.wait();
|
294
292
|
return receipt.transactionHash;
|
package/dist/types/PerqConfig.js
CHANGED
@@ -10,6 +10,7 @@ exports.PRODUCTION = {
|
|
10
10
|
perqSwapAndRecyclerAddress: '0x15ED53964E6a5EcbEBAb80A0Fc68c2297b0eaA8D',
|
11
11
|
perqVestingAddress: '0x5e19C155C30bDEB83FCFE20a3b6f6Eda34B746c5',
|
12
12
|
swapAndDepositContractAddress: '0xd8534197bd587f8226d12e0c864ef2cae6f82f5c',
|
13
|
+
swapperAddress: '0x33e52c206d584550193e642c8982f2fff6339994',
|
13
14
|
smartVaultManagerContractAddress: '0x23daf34e2b9af02a74dc19cb52af727b19403874',
|
14
15
|
};
|
15
16
|
exports.DEVELOPMENT = {
|
@@ -20,5 +21,6 @@ exports.DEVELOPMENT = {
|
|
20
21
|
perqSwapAndRecyclerAddress: '0xA4ed357FF233731860Ec8D0446FD95756d564014',
|
21
22
|
perqVestingAddress: '0x1d3B9E32a7139718f94BE32c797682fFf2D1bE60',
|
22
23
|
swapAndDepositContractAddress: '0x5fb08e00de169f041711206a0995410884080177',
|
24
|
+
swapperAddress: '0xE411921ee9EeDfEFd7b9Ae15bF232bd36949Fcbc',
|
23
25
|
smartVaultManagerContractAddress: '0x2638d6c0b4ef6dee04050fa0b07ca62500435747',
|
24
26
|
};
|