@defisaver/automation-sdk 2.1.4 → 2.1.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.
@@ -183,8 +183,8 @@ exports.compoundV3LeverageManagementSubData = {
183
183
  exports.compoundV3L2LeverageManagementSubData = {
184
184
  encode(market, baseToken, triggerRepayRatio, triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled) {
185
185
  let subInput = '0x';
186
- subInput = subInput.concat(market.slice(2).padStart(32, '0'));
187
- subInput = subInput.concat(baseToken.slice(2).padStart(32, '0'));
186
+ subInput = subInput.concat(market.slice(2));
187
+ subInput = subInput.concat(baseToken.slice(2));
188
188
  subInput = subInput.concat(new decimal_js_1.default(triggerRepayRatio).mul(1e16).toHex().slice(2)
189
189
  .padStart(32, '0'));
190
190
  subInput = subInput.concat(new decimal_js_1.default(triggerBoostRatio).mul(1e16).toHex().slice(2)
@@ -197,6 +197,7 @@ exports.compoundV3L2LeverageManagementSubData = {
197
197
  return subInput;
198
198
  },
199
199
  decode(subData) {
200
+ console.log(subData);
200
201
  const ratioWei = web3_eth_abi_1.default.decodeParameter('uint256', subData[3]);
201
202
  const targetRatio = (0, utils_1.weiToRatioPercentage)(ratioWei);
202
203
  return { targetRatio };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/index.js",
@@ -3,7 +3,7 @@ import AbiCoder from 'web3-eth-abi';
3
3
  import { assetAmountInEth, getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
4
4
  import { otherAddresses } from '@defisaver/sdk';
5
5
 
6
- import type { EthereumAddress, SubData } from '../types';
6
+ import type { SubData, EthereumAddress } from '../types';
7
7
  import type { OrderType } from '../types/enums';
8
8
  import { ChainId, RatioState } from '../types/enums';
9
9
 
@@ -267,8 +267,8 @@ export const compoundV3L2LeverageManagementSubData = {
267
267
  ): string {
268
268
  let subInput = '0x';
269
269
 
270
- subInput = subInput.concat(market.slice(2).padStart(32, '0'));
271
- subInput = subInput.concat(baseToken.slice(2).padStart(32, '0'));
270
+ subInput = subInput.concat(market.slice(2));
271
+ subInput = subInput.concat(baseToken.slice(2));
272
272
  subInput = subInput.concat(new Dec(triggerRepayRatio).mul(1e16).toHex().slice(2)
273
273
  .padStart(32, '0'));
274
274
  subInput = subInput.concat(new Dec(triggerBoostRatio).mul(1e16).toHex().slice(2)
@@ -282,6 +282,7 @@ export const compoundV3L2LeverageManagementSubData = {
282
282
  return subInput;
283
283
  },
284
284
  decode(subData: SubData): { targetRatio: number } {
285
+ console.log(subData);
285
286
  const ratioWei = AbiCoder.decodeParameter('uint256', subData[3]) as any as string;
286
287
  const targetRatio = weiToRatioPercentage(ratioWei);
287
288