@defisaver/automation-sdk 1.2.14 → 1.2.15
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/esm/services/strategySubService.d.ts +1 -1
- package/esm/services/strategySubService.js +2 -2
- package/esm/services/subDataService.d.ts +1 -1
- package/esm/services/subDataService.js +3 -2
- package/esm/services/triggerService.d.ts +2 -1
- package/esm/services/triggerService.js +2 -1
- package/package.json +1 -1
- package/src/services/strategySubService.ts +2 -1
- package/src/services/subDataService.ts +3 -2
- package/src/services/triggerService.ts +3 -2
- package/umd/index.js +7 -6
|
@@ -36,5 +36,5 @@ export declare const morphoAaveV2Encode: {
|
|
|
36
36
|
};
|
|
37
37
|
export declare const exchangeEncode: {
|
|
38
38
|
dca(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, timestamp: number, interval: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
39
|
-
limitOrder(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string): string[];
|
|
39
|
+
limitOrder(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string, orderType: number): string[];
|
|
40
40
|
};
|
|
@@ -112,7 +112,7 @@ export const exchangeEncode = {
|
|
|
112
112
|
const strategyId = Strategies.MainnetIds.EXCHANGE_DCA;
|
|
113
113
|
return [strategyId, false, triggerData, subData];
|
|
114
114
|
},
|
|
115
|
-
limitOrder(fromToken, toToken, amount, targetPrice, goodUntil) {
|
|
116
|
-
return subDataService.exchangeLimitOrderSubData.encode(fromToken, toToken, amount, targetPrice, goodUntil);
|
|
115
|
+
limitOrder(fromToken, toToken, amount, targetPrice, goodUntil, orderType) {
|
|
116
|
+
return subDataService.exchangeLimitOrderSubData.encode(fromToken, toToken, amount, targetPrice, goodUntil, orderType);
|
|
117
117
|
},
|
|
118
118
|
};
|
|
@@ -83,7 +83,7 @@ export declare const exchangeDcaSubData: {
|
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
export declare const exchangeLimitOrderSubData: {
|
|
86
|
-
encode(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string): string[];
|
|
86
|
+
encode(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string | number, orderType: number): string[];
|
|
87
87
|
decode: (subData: string[]) => {
|
|
88
88
|
fromToken: string;
|
|
89
89
|
toToken: string;
|
|
@@ -200,13 +200,14 @@ export const exchangeDcaSubData = {
|
|
|
200
200
|
},
|
|
201
201
|
};
|
|
202
202
|
export const exchangeLimitOrderSubData = {
|
|
203
|
-
encode(fromToken, toToken, amount, targetPrice, goodUntil) {
|
|
203
|
+
encode(fromToken, toToken, amount, targetPrice, goodUntil, orderType) {
|
|
204
204
|
return [
|
|
205
205
|
fromToken,
|
|
206
206
|
toToken,
|
|
207
207
|
amount,
|
|
208
208
|
targetPrice,
|
|
209
|
-
goodUntil,
|
|
209
|
+
new Dec(goodUntil).toString(),
|
|
210
|
+
new Dec(orderType).toString(),
|
|
210
211
|
];
|
|
211
212
|
},
|
|
212
213
|
decode: (subData) => {
|
|
@@ -107,7 +107,8 @@ export declare const exchangeTimestampTrigger: {
|
|
|
107
107
|
export declare const exchangeOffchainPriceTrigger: {
|
|
108
108
|
encode(targetPrice: string, goodUntil: number, fromTokenDecimals: number): string[];
|
|
109
109
|
decode(triggerData: string[], fromTokenDecimals: number): {
|
|
110
|
+
orderType: number;
|
|
110
111
|
targetPrice: string;
|
|
111
|
-
goodUntil:
|
|
112
|
+
goodUntil: any;
|
|
112
113
|
};
|
|
113
114
|
};
|
|
@@ -179,11 +179,12 @@ export const exchangeOffchainPriceTrigger = {
|
|
|
179
179
|
return [mockedWeb3.eth.abi.encodeParameters(['uint256', 'uint256'], [price, goodUntilWei])];
|
|
180
180
|
},
|
|
181
181
|
decode(triggerData, fromTokenDecimals) {
|
|
182
|
-
const decodedData = mockedWeb3.eth.abi.decodeParameters(['uint256', 'uint256'], triggerData[0]);
|
|
182
|
+
const decodedData = mockedWeb3.eth.abi.decodeParameters(['uint256', 'uint256', 'uint8'], triggerData[0]);
|
|
183
183
|
const price = new Dec(decodedData[0]).div(new Dec(10).pow(fromTokenDecimals)).toDP(fromTokenDecimals).toString();
|
|
184
184
|
return {
|
|
185
185
|
targetPrice: price,
|
|
186
186
|
goodUntil: decodedData[1],
|
|
187
|
+
orderType: +decodedData[2],
|
|
187
188
|
};
|
|
188
189
|
},
|
|
189
190
|
};
|
package/package.json
CHANGED
|
@@ -251,7 +251,8 @@ export const exchangeEncode = {
|
|
|
251
251
|
amount: string,
|
|
252
252
|
targetPrice: string,
|
|
253
253
|
goodUntil: string,
|
|
254
|
+
orderType: number,
|
|
254
255
|
) {
|
|
255
|
-
return subDataService.exchangeLimitOrderSubData.encode(fromToken, toToken, amount, targetPrice, goodUntil);
|
|
256
|
+
return subDataService.exchangeLimitOrderSubData.encode(fromToken, toToken, amount, targetPrice, goodUntil, orderType);
|
|
256
257
|
},
|
|
257
258
|
};
|
|
@@ -276,13 +276,14 @@ export const exchangeDcaSubData = {
|
|
|
276
276
|
};
|
|
277
277
|
|
|
278
278
|
export const exchangeLimitOrderSubData = {
|
|
279
|
-
encode(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string) : SubData {
|
|
279
|
+
encode(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string | number, orderType: number) : SubData {
|
|
280
280
|
return [
|
|
281
281
|
fromToken,
|
|
282
282
|
toToken,
|
|
283
283
|
amount,
|
|
284
284
|
targetPrice,
|
|
285
|
-
goodUntil,
|
|
285
|
+
new Dec(goodUntil).toString(),
|
|
286
|
+
new Dec(orderType).toString(),
|
|
286
287
|
];
|
|
287
288
|
},
|
|
288
289
|
decode: (subData: SubData) => {
|
|
@@ -224,12 +224,13 @@ export const exchangeOffchainPriceTrigger = {
|
|
|
224
224
|
decode(
|
|
225
225
|
triggerData: TriggerData,
|
|
226
226
|
fromTokenDecimals: number,
|
|
227
|
-
): { targetPrice: string
|
|
228
|
-
const decodedData = mockedWeb3.eth.abi.decodeParameters(['uint256', 'uint256'], triggerData[0]);
|
|
227
|
+
): { orderType: number; targetPrice: string; goodUntil: any } {
|
|
228
|
+
const decodedData = mockedWeb3.eth.abi.decodeParameters(['uint256', 'uint256', 'uint8'], triggerData[0]);
|
|
229
229
|
const price = new Dec(decodedData[0]).div(new Dec(10).pow(fromTokenDecimals)).toDP(fromTokenDecimals).toString();
|
|
230
230
|
return {
|
|
231
231
|
targetPrice: price,
|
|
232
232
|
goodUntil: decodedData[1],
|
|
233
|
+
orderType: +decodedData[2],
|
|
233
234
|
};
|
|
234
235
|
},
|
|
235
236
|
};
|
package/umd/index.js
CHANGED
|
@@ -19284,8 +19284,8 @@ var exchangeDcaSubData = {
|
|
|
19284
19284
|
}
|
|
19285
19285
|
};
|
|
19286
19286
|
var exchangeLimitOrderSubData = {
|
|
19287
|
-
encode(fromToken, toToken, amount, targetPrice, goodUntil) {
|
|
19288
|
-
return [fromToken, toToken, amount, targetPrice, goodUntil];
|
|
19287
|
+
encode(fromToken, toToken, amount, targetPrice, goodUntil, orderType) {
|
|
19288
|
+
return [fromToken, toToken, amount, targetPrice, new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(goodUntil).toString(), new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(orderType).toString()];
|
|
19289
19289
|
},
|
|
19290
19290
|
decode: subData => {
|
|
19291
19291
|
var fromToken = mockedWeb3.eth.abi.decodeParameter('address', subData[0]).toString();
|
|
@@ -29235,11 +29235,12 @@ var exchangeOffchainPriceTrigger = {
|
|
|
29235
29235
|
return [mockedWeb3.eth.abi.encodeParameters(['uint256', 'uint256'], [price, goodUntilWei])];
|
|
29236
29236
|
},
|
|
29237
29237
|
decode(triggerData, fromTokenDecimals) {
|
|
29238
|
-
var decodedData = mockedWeb3.eth.abi.decodeParameters(['uint256', 'uint256'], triggerData[0]);
|
|
29238
|
+
var decodedData = mockedWeb3.eth.abi.decodeParameters(['uint256', 'uint256', 'uint8'], triggerData[0]);
|
|
29239
29239
|
var price = new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(decodedData[0]).div(new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(10).pow(fromTokenDecimals)).toDP(fromTokenDecimals).toString();
|
|
29240
29240
|
return {
|
|
29241
29241
|
targetPrice: price,
|
|
29242
|
-
goodUntil: decodedData[1]
|
|
29242
|
+
goodUntil: decodedData[1],
|
|
29243
|
+
orderType: +decodedData[2]
|
|
29243
29244
|
};
|
|
29244
29245
|
}
|
|
29245
29246
|
};
|
|
@@ -29448,8 +29449,8 @@ var exchangeEncode = {
|
|
|
29448
29449
|
var strategyId = _types_enums__WEBPACK_IMPORTED_MODULE_2__.Strategies.MainnetIds.EXCHANGE_DCA;
|
|
29449
29450
|
return [strategyId, false, triggerData, subData];
|
|
29450
29451
|
},
|
|
29451
|
-
limitOrder(fromToken, toToken, amount, targetPrice, goodUntil) {
|
|
29452
|
-
return _subDataService__WEBPACK_IMPORTED_MODULE_3__.exchangeLimitOrderSubData.encode(fromToken, toToken, amount, targetPrice, goodUntil);
|
|
29452
|
+
limitOrder(fromToken, toToken, amount, targetPrice, goodUntil, orderType) {
|
|
29453
|
+
return _subDataService__WEBPACK_IMPORTED_MODULE_3__.exchangeLimitOrderSubData.encode(fromToken, toToken, amount, targetPrice, goodUntil, orderType);
|
|
29453
29454
|
}
|
|
29454
29455
|
};
|
|
29455
29456
|
|