From a8f7e96ac24c843d5de991d550991128904d2d51 Mon Sep 17 00:00:00 2001 From: Alexandr Kazachenko Date: Tue, 3 Dec 2024 15:38:48 +0500 Subject: [PATCH] fix: do not add excessive parameters in `TwapData` (#226) --- src/composable/orderTypes/Twap.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/composable/orderTypes/Twap.ts b/src/composable/orderTypes/Twap.ts index 66ceaa76..c2d2cb5e 100644 --- a/src/composable/orderTypes/Twap.ts +++ b/src/composable/orderTypes/Twap.ts @@ -578,7 +578,18 @@ export function transformDataToStruct(data: TwapData): TwapStruct { * @returns {TwapStruct} A formatted struct as expected by the smart contract. */ export function transformStructToData(struct: TwapStruct): TwapData { - const { n: numberOfParts, partSellAmount, minPartLimit, t: timeBetweenParts, t0: startEpoch, span, ...rest } = struct + const { + n: numberOfParts, + partSellAmount, + minPartLimit, + t: timeBetweenParts, + t0: startEpoch, + span, + sellToken, + buyToken, + receiver, + appData, + } = struct const durationOfPart: DurationOfPart = span.isZero() ? { durationType: DurationType.AUTO } @@ -595,6 +606,9 @@ export function transformStructToData(struct: TwapStruct): TwapData { numberOfParts, timeBetweenParts, durationOfPart, - ...rest, + sellToken, + buyToken, + receiver, + appData, } }