@nadohq/trigger-client 0.1.0-alpha.3 → 0.1.0-alpha.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.
Files changed (64) hide show
  1. package/dist/TriggerClient.cjs +22 -15
  2. package/dist/TriggerClient.cjs.map +1 -1
  3. package/dist/TriggerClient.d.cts +3 -2
  4. package/dist/TriggerClient.d.ts +3 -2
  5. package/dist/TriggerClient.js +15 -7
  6. package/dist/TriggerClient.js.map +1 -1
  7. package/dist/dataMappers.cjs +125 -68
  8. package/dist/dataMappers.cjs.map +1 -1
  9. package/dist/dataMappers.d.cts +21 -8
  10. package/dist/dataMappers.d.ts +21 -8
  11. package/dist/dataMappers.js +124 -65
  12. package/dist/dataMappers.js.map +1 -1
  13. package/dist/endpoints.cjs +2 -2
  14. package/dist/endpoints.cjs.map +1 -1
  15. package/dist/endpoints.d.cts +1 -1
  16. package/dist/endpoints.d.ts +1 -1
  17. package/dist/endpoints.js +2 -2
  18. package/dist/endpoints.js.map +1 -1
  19. package/dist/index.d.cts +6 -5
  20. package/dist/index.d.ts +6 -5
  21. package/dist/types/TriggerServerFailureError.cjs +1 -1
  22. package/dist/types/TriggerServerFailureError.cjs.map +1 -1
  23. package/dist/types/TriggerServerFailureError.d.cts +3 -2
  24. package/dist/types/TriggerServerFailureError.d.ts +3 -2
  25. package/dist/types/TriggerServerFailureError.js +1 -1
  26. package/dist/types/TriggerServerFailureError.js.map +1 -1
  27. package/dist/types/clientModelTypes.cjs +19 -0
  28. package/dist/types/clientModelTypes.cjs.map +1 -0
  29. package/dist/types/clientModelTypes.d.cts +55 -0
  30. package/dist/types/clientModelTypes.d.ts +55 -0
  31. package/dist/types/clientModelTypes.js +1 -0
  32. package/dist/types/clientModelTypes.js.map +1 -0
  33. package/dist/types/clientTypes.cjs.map +1 -1
  34. package/dist/types/clientTypes.d.cts +15 -23
  35. package/dist/types/clientTypes.d.ts +15 -23
  36. package/dist/types/index.cjs +4 -0
  37. package/dist/types/index.cjs.map +1 -1
  38. package/dist/types/index.d.cts +6 -5
  39. package/dist/types/index.d.ts +6 -5
  40. package/dist/types/index.js +2 -0
  41. package/dist/types/index.js.map +1 -1
  42. package/dist/types/serverExecuteTypes.cjs.map +1 -1
  43. package/dist/types/serverExecuteTypes.d.cts +4 -15
  44. package/dist/types/serverExecuteTypes.d.ts +4 -15
  45. package/dist/types/serverModelTypes.cjs +19 -0
  46. package/dist/types/serverModelTypes.cjs.map +1 -0
  47. package/dist/types/serverModelTypes.d.cts +42 -0
  48. package/dist/types/serverModelTypes.d.ts +42 -0
  49. package/dist/types/serverModelTypes.js +1 -0
  50. package/dist/types/serverModelTypes.js.map +1 -0
  51. package/dist/types/serverQueryTypes.cjs.map +1 -1
  52. package/dist/types/serverQueryTypes.d.cts +6 -2
  53. package/dist/types/serverQueryTypes.d.ts +6 -2
  54. package/package.json +4 -5
  55. package/src/TriggerClient.ts +14 -6
  56. package/src/dataMappers.ts +173 -69
  57. package/src/endpoints.ts +2 -2
  58. package/src/types/TriggerServerFailureError.ts +2 -2
  59. package/src/types/clientModelTypes.ts +79 -0
  60. package/src/types/clientTypes.ts +20 -38
  61. package/src/types/index.ts +2 -0
  62. package/src/types/serverExecuteTypes.ts +3 -24
  63. package/src/types/serverModelTypes.ts +55 -0
  64. package/src/types/serverQueryTypes.ts +5 -1
@@ -1,20 +1,120 @@
1
+ import { unpackOrderAppendix } from '@nadohq/shared';
1
2
  import {
2
3
  addDecimals,
3
4
  removeDecimals,
4
5
  toBigDecimal,
5
6
  toIntegerString,
6
- } from '@nadohq/utils';
7
+ } from '@nadohq/shared';
7
8
  import {
9
+ PriceTriggerCriteria,
10
+ PriceTriggerRequirementType,
11
+ TimeTriggerCriteria,
8
12
  TriggerCriteria,
9
13
  TriggerOrder,
10
14
  TriggerOrderInfo,
11
15
  TriggerOrderStatus,
12
16
  TriggerServerOrderInfo,
13
17
  TriggerServerOrderStatus,
18
+ TriggerServerPriceRequirement,
19
+ TriggerServerPriceTriggerCriteria,
20
+ TriggerServerTimeTriggerCriteria,
14
21
  TriggerServerTriggerCriteria,
15
22
  } from './types';
16
23
 
17
- export function mapTriggerServerOrderStatus(
24
+ /**
25
+ * Maps client-side trigger criteria to server-side trigger criteria format.
26
+ * Converts price and time triggers to their respective server representations
27
+ * with proper decimal scaling and field name transformations.
28
+ *
29
+ * @param criteria - The client-side trigger criteria (price or time based)
30
+ * @returns The server-formatted trigger criteria ready for API transmission
31
+ */
32
+ export function mapTriggerCriteria(
33
+ criteria: TriggerCriteria,
34
+ ): TriggerServerTriggerCriteria {
35
+ switch (criteria.type) {
36
+ case 'price':
37
+ return {
38
+ price_trigger: mapPriceTriggerCriteria(criteria.criteria),
39
+ };
40
+ case 'time':
41
+ return {
42
+ time_trigger: mapTimeTriggerCriteria(criteria.criteria),
43
+ };
44
+ }
45
+ }
46
+
47
+ function mapPriceTriggerCriteria(
48
+ criteria: PriceTriggerCriteria,
49
+ ): TriggerServerPriceTriggerCriteria {
50
+ const priceValue = toIntegerString(addDecimals(criteria.triggerPrice));
51
+
52
+ const price_requirement = ((): TriggerServerPriceRequirement => {
53
+ switch (criteria.type) {
54
+ case 'oracle_price_above':
55
+ return { oracle_price_above: priceValue };
56
+ case 'oracle_price_below':
57
+ return { oracle_price_below: priceValue };
58
+ case 'last_price_above':
59
+ return { last_price_above: priceValue };
60
+ case 'last_price_below':
61
+ return { last_price_below: priceValue };
62
+ case 'mid_price_above':
63
+ return { mid_price_above: priceValue };
64
+ case 'mid_price_below':
65
+ return { mid_price_below: priceValue };
66
+ }
67
+ })();
68
+
69
+ return {
70
+ price_requirement,
71
+ dependency: criteria.dependency
72
+ ? {
73
+ digest: criteria.dependency.digest,
74
+ on_partial_fill: criteria.dependency.onPartialFill,
75
+ }
76
+ : undefined,
77
+ };
78
+ }
79
+
80
+ function mapTimeTriggerCriteria(
81
+ criteria: TimeTriggerCriteria,
82
+ ): TriggerServerTimeTriggerCriteria {
83
+ return {
84
+ interval: toIntegerString(criteria.interval),
85
+ amounts: criteria.amounts?.map((amount) => toIntegerString(amount)),
86
+ };
87
+ }
88
+
89
+ /**
90
+ * Maps complete server-side trigger order information to client-side format.
91
+ *
92
+ * @param info - The complete server-side trigger order information including order, status, and timestamps
93
+ * @returns The client-side trigger order information with converted values and normalized structure
94
+ */
95
+ export function mapServerOrderInfo(
96
+ info: TriggerServerOrderInfo,
97
+ ): TriggerOrderInfo {
98
+ const { order: serverOrder, status, updated_at } = info;
99
+ const order: TriggerOrder = {
100
+ amount: toBigDecimal(serverOrder.order.amount),
101
+ expiration: Number(serverOrder.order.expiration),
102
+ nonce: serverOrder.order.nonce,
103
+ price: removeDecimals(toBigDecimal(serverOrder.order.priceX18)),
104
+ digest: serverOrder.digest,
105
+ productId: serverOrder.product_id,
106
+ triggerCriteria: mapServerTriggerCriteria(serverOrder.trigger),
107
+ appendix: unpackOrderAppendix(serverOrder.order.appendix),
108
+ };
109
+ return {
110
+ serverOrder,
111
+ order,
112
+ status: mapTriggerServerOrderStatus(status),
113
+ updatedAt: updated_at,
114
+ };
115
+ }
116
+
117
+ function mapTriggerServerOrderStatus(
18
118
  status: TriggerServerOrderStatus,
19
119
  ): TriggerOrderStatus {
20
120
  if (status === 'pending') {
@@ -40,85 +140,89 @@ export function mapTriggerServerOrderStatus(
40
140
  throw Error(`Unknown trigger order status: ${JSON.stringify(status)}`);
41
141
  }
42
142
 
43
- export function mapTriggerCriteria(
44
- criteria: TriggerCriteria,
45
- ): TriggerServerTriggerCriteria {
46
- const priceValue = toIntegerString(addDecimals(criteria.triggerPrice));
47
- switch (criteria.type) {
48
- case 'oracle_price_above':
49
- return { price_above: priceValue };
50
- case 'oracle_price_below':
51
- return { price_below: priceValue };
52
- case 'last_price_above':
53
- return { last_price_above: priceValue };
54
- case 'last_price_below':
55
- return { last_price_below: priceValue };
56
- case 'mid_price_above':
57
- return { mid_price_above: priceValue };
58
- case 'mid_price_below':
59
- return { mid_price_below: priceValue };
60
- }
61
- }
62
-
63
- export function mapServerTriggerCriteria(
143
+ function mapServerTriggerCriteria(
64
144
  criteria: TriggerServerTriggerCriteria,
65
145
  ): TriggerCriteria {
66
- if ('price_above' in criteria) {
67
- return {
68
- type: 'oracle_price_above',
69
- triggerPrice: removeDecimals(criteria.price_above),
70
- };
71
- }
72
- if ('price_below' in criteria) {
146
+ if ('price_trigger' in criteria) {
73
147
  return {
74
- type: 'oracle_price_below',
75
- triggerPrice: removeDecimals(criteria.price_below),
148
+ type: 'price',
149
+ criteria: mapServerPriceTriggerCriteria(criteria.price_trigger),
76
150
  };
77
151
  }
78
- if ('last_price_above' in criteria) {
152
+ if ('time_trigger' in criteria) {
79
153
  return {
80
- type: 'last_price_above',
81
- triggerPrice: removeDecimals(criteria.last_price_above),
82
- };
83
- }
84
- if ('last_price_below' in criteria) {
85
- return {
86
- type: 'last_price_below',
87
- triggerPrice: removeDecimals(criteria.last_price_below),
88
- };
89
- }
90
- if ('mid_price_above' in criteria) {
91
- return {
92
- type: 'mid_price_above',
93
- triggerPrice: removeDecimals(criteria.mid_price_above),
94
- };
95
- }
96
- if ('mid_price_below' in criteria) {
97
- return {
98
- type: 'mid_price_below',
99
- triggerPrice: removeDecimals(criteria.mid_price_below),
154
+ type: 'time',
155
+ criteria: mapServerTimeTriggerCriteria(criteria.time_trigger),
100
156
  };
101
157
  }
102
158
  throw new Error(`Unknown trigger criteria: ${JSON.stringify(criteria)}`);
103
159
  }
104
160
 
105
- export function mapServerOrderInfo(
106
- info: TriggerServerOrderInfo,
107
- ): TriggerOrderInfo {
108
- const { order: serverOrder, status, updated_at } = info;
109
- const order: TriggerOrder = {
110
- amount: toBigDecimal(serverOrder.order.amount),
111
- expiration: toBigDecimal(serverOrder.order.expiration),
112
- nonce: serverOrder.order.nonce,
113
- price: removeDecimals(toBigDecimal(serverOrder.order.priceX18)),
114
- digest: serverOrder.digest,
115
- productId: serverOrder.product_id,
116
- triggerCriteria: mapServerTriggerCriteria(serverOrder.trigger),
161
+ function mapServerPriceTriggerCriteria(
162
+ serverCriteria: TriggerServerPriceTriggerCriteria,
163
+ ): PriceTriggerCriteria {
164
+ const { price_requirement, dependency } = serverCriteria;
165
+
166
+ const { type, triggerPrice } = ((): {
167
+ type: PriceTriggerRequirementType;
168
+ triggerPrice: string;
169
+ } => {
170
+ if ('oracle_price_above' in price_requirement) {
171
+ return {
172
+ type: 'oracle_price_above',
173
+ triggerPrice: price_requirement.oracle_price_above,
174
+ };
175
+ } else if ('oracle_price_below' in price_requirement) {
176
+ return {
177
+ type: 'oracle_price_below',
178
+ triggerPrice: price_requirement.oracle_price_below,
179
+ };
180
+ } else if ('last_price_above' in price_requirement) {
181
+ return {
182
+ type: 'last_price_above',
183
+ triggerPrice: price_requirement.last_price_above,
184
+ };
185
+ } else if ('last_price_below' in price_requirement) {
186
+ return {
187
+ type: 'last_price_below',
188
+ triggerPrice: price_requirement.last_price_below,
189
+ };
190
+ } else if ('mid_price_above' in price_requirement) {
191
+ return {
192
+ type: 'mid_price_above',
193
+ triggerPrice: price_requirement.mid_price_above,
194
+ };
195
+ } else if ('mid_price_below' in price_requirement) {
196
+ return {
197
+ type: 'mid_price_below',
198
+ triggerPrice: price_requirement.mid_price_below,
199
+ };
200
+ } else {
201
+ throw new Error(
202
+ `Unknown price requirement: ${JSON.stringify(price_requirement)}`,
203
+ );
204
+ }
205
+ })();
206
+
207
+ return {
208
+ type,
209
+ triggerPrice: removeDecimals(triggerPrice),
210
+ dependency: dependency
211
+ ? {
212
+ digest: dependency.digest,
213
+ onPartialFill: dependency.on_partial_fill,
214
+ }
215
+ : undefined,
117
216
  };
217
+ }
218
+
219
+ function mapServerTimeTriggerCriteria(
220
+ serverCriteria: TriggerServerTimeTriggerCriteria,
221
+ ): TimeTriggerCriteria {
118
222
  return {
119
- serverOrder,
120
- order,
121
- status: mapTriggerServerOrderStatus(status),
122
- updatedAt: updated_at,
223
+ interval: toBigDecimal(serverCriteria.interval),
224
+ amounts: serverCriteria.amounts?.map((amount: string) =>
225
+ toBigDecimal(amount),
226
+ ),
123
227
  };
124
228
  }
package/src/endpoints.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ChainEnv } from '@nadohq/contracts';
1
+ import { ChainEnv } from '@nadohq/shared';
2
2
 
3
3
  export const TRIGGER_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {
4
4
  local: 'http://localhost:80/trigger',
5
- arbitrumTestnet: 'https://trigger.sepolia-test.vertexprotocol.com/v1',
6
5
  arbitrum: 'https://trigger.prod.vertexprotocol.com/v1',
6
+ inkTestnet: 'https://trigger.test.nado-backend.xyz/v1',
7
7
  };
@@ -1,5 +1,5 @@
1
- import { TriggerServerQueryFailureResponse } from './serverQueryTypes';
2
1
  import { EngineServerExecuteFailureResult } from '@nadohq/engine-client';
2
+ import { TriggerServerQueryFailureResponse } from './serverQueryTypes';
3
3
 
4
4
  export class TriggerServerFailureError extends Error {
5
5
  constructor(
@@ -7,6 +7,6 @@ export class TriggerServerFailureError extends Error {
7
7
  | TriggerServerQueryFailureResponse
8
8
  | EngineServerExecuteFailureResult,
9
9
  ) {
10
- super();
10
+ super(`${responseData.error_code}: ${responseData.error}`);
11
11
  }
12
12
  }
@@ -0,0 +1,79 @@
1
+ import { EngineServerExecuteResult } from '@nadohq/engine-client';
2
+ import { BigDecimalish } from '@nadohq/shared';
3
+
4
+ /*
5
+ Price trigger
6
+ */
7
+
8
+ export type PriceTriggerRequirementType =
9
+ | 'oracle_price_above'
10
+ | 'oracle_price_below'
11
+ | 'last_price_above'
12
+ | 'last_price_below'
13
+ | 'mid_price_above'
14
+ | 'mid_price_below';
15
+
16
+ export interface PriceTriggerDependency {
17
+ /**
18
+ * Digest of the order that this trigger depends on.
19
+ */
20
+ digest: string;
21
+ /**
22
+ * Whether to trigger on partial fills.
23
+ */
24
+ onPartialFill: boolean;
25
+ }
26
+
27
+ export interface PriceTriggerCriteria {
28
+ type: PriceTriggerRequirementType;
29
+ triggerPrice: BigDecimalish;
30
+ dependency?: PriceTriggerDependency;
31
+ }
32
+
33
+ /*
34
+ Time trigger (for TWAP)
35
+ */
36
+
37
+ export interface TimeTriggerCriteria {
38
+ /**
39
+ * For TWAP: Trigger interval in seconds
40
+ */
41
+ interval: BigDecimalish;
42
+ /**
43
+ * For TWAP: By default, trigger service will split up orders as per total amount / interval
44
+ * If you want to specify the amounts for each interval, you can provide them here.
45
+ */
46
+ amounts?: BigDecimalish[];
47
+ }
48
+
49
+ /**
50
+ * All possible trigger conditions that can be used to place a trigger order.
51
+ */
52
+ export type TriggerCriteria =
53
+ | {
54
+ type: 'price';
55
+ criteria: PriceTriggerCriteria;
56
+ }
57
+ | {
58
+ type: 'time';
59
+ criteria: TimeTriggerCriteria;
60
+ };
61
+
62
+ export type TriggerCriteriaType = TriggerCriteria['type'];
63
+
64
+ export type TriggerOrderStatus =
65
+ | {
66
+ type: 'pending';
67
+ }
68
+ | {
69
+ type: 'cancelled';
70
+ reason: string;
71
+ }
72
+ | {
73
+ type: 'triggered';
74
+ result: EngineServerExecuteResult;
75
+ }
76
+ | {
77
+ type: 'internal_error';
78
+ error: string;
79
+ };
@@ -1,49 +1,24 @@
1
1
  import {
2
2
  EIP712CancelOrdersParams,
3
3
  EIP712CancelProductOrdersParams,
4
+ OrderAppendix,
4
5
  Subaccount,
5
- } from '@nadohq/contracts';
6
+ } from '@nadohq/shared';
7
+ import { EngineOrderParams } from '@nadohq/engine-client';
8
+ import { BigDecimal } from '@nadohq/shared';
9
+ import { TriggerCriteria, TriggerOrderStatus } from './clientModelTypes';
6
10
  import {
7
- EngineOrderParams,
8
- EngineServerExecuteResult,
9
- } from '@nadohq/engine-client';
10
- import { BigDecimal, BigDecimalish } from '@nadohq/utils';
11
- import { TriggerServerOrder } from './serverQueryTypes';
11
+ TriggerServerOrder,
12
+ TriggerServerTriggerTypeFilter,
13
+ } from './serverQueryTypes';
12
14
 
13
15
  type WithOptionalNonce<T> = Omit<T, 'nonce'> & { nonce?: string };
14
16
 
15
- export type TriggerCriteriaType =
16
- | 'oracle_price_above'
17
- | 'oracle_price_below'
18
- | 'last_price_above'
19
- | 'last_price_below'
20
- | 'mid_price_above'
21
- | 'mid_price_below';
22
-
23
- export type TriggerCriteria = {
24
- type: TriggerCriteriaType;
25
- triggerPrice: BigDecimalish;
26
- };
27
-
28
- export type TriggerOrderStatus =
29
- | {
30
- type: 'pending';
31
- }
32
- | {
33
- type: 'cancelled';
34
- reason: string;
35
- }
36
- | {
37
- type: 'triggered';
38
- result: EngineServerExecuteResult;
39
- }
40
- | {
41
- type: 'internal_error';
42
- error: string;
43
- };
44
-
45
17
  interface SignatureParams {
46
- // Orderbook address for placement, endpoint address for cancellation & listing
18
+ /**
19
+ * Address derived from productId for placement (see getOrderVerifyingAddr)
20
+ * endpoint address for cancellation & listing
21
+ */
47
22
  verifyingAddr: string;
48
23
  chainId: number;
49
24
  }
@@ -59,6 +34,8 @@ export interface TriggerPlaceOrderParams extends SignatureParams {
59
34
  triggerCriteria: TriggerCriteria;
60
35
  // If not given, engine defaults to true (leverage/borrow enabled)
61
36
  spotLeverage?: boolean;
37
+ // For isolated orders, this specifies whether margin can be borrowed (i.e. whether the cross account can have a negative USDC balance)
38
+ borrowMargin?: boolean;
62
39
  digest?: string;
63
40
  nonce?: string;
64
41
  }
@@ -85,6 +62,10 @@ export interface TriggerListOrdersParams extends Subaccount, SignatureParams {
85
62
  // When provided, the associated trigger orders are returned regardless of other filters
86
63
  digests?: string[];
87
64
  limit?: number;
65
+ // Filter by trigger types
66
+ triggerTypes?: TriggerServerTriggerTypeFilter[];
67
+ // Filter by reduce-only orders
68
+ reduceOnly?: boolean;
88
69
  }
89
70
 
90
71
  export interface TriggerOrder {
@@ -92,9 +73,10 @@ export interface TriggerOrder {
92
73
  triggerCriteria: TriggerCriteria;
93
74
  price: BigDecimal;
94
75
  amount: BigDecimal;
95
- expiration: BigDecimal;
76
+ expiration: number;
96
77
  nonce: string;
97
78
  digest: string;
79
+ appendix: OrderAppendix;
98
80
  }
99
81
 
100
82
  export interface TriggerOrderInfo {
@@ -1,4 +1,6 @@
1
+ export * from './clientModelTypes';
1
2
  export * from './clientTypes';
3
+ export * from './serverModelTypes';
2
4
  export * from './serverExecuteTypes';
3
5
  export * from './serverQueryTypes';
4
6
  export * from './TriggerServerFailureError';
@@ -1,32 +1,10 @@
1
- import { EIP712OrderValues } from '@nadohq/contracts';
1
+ import { EIP712OrderValues } from '@nadohq/shared';
2
2
  import {
3
3
  EngineServerExecuteFailureResult,
4
4
  EngineServerExecuteRequestByType,
5
5
  EngineServerExecuteSuccessResult,
6
6
  } from '@nadohq/engine-client';
7
-
8
- export type TriggerServerTriggerCriteria =
9
- // These trigger on fast oracle price
10
- | {
11
- price_above: string;
12
- }
13
- | {
14
- price_below: string;
15
- }
16
- // These trigger on last trade price
17
- | {
18
- last_price_above: string;
19
- }
20
- | {
21
- last_price_below: string;
22
- }
23
- // These trigger on mid-book price
24
- | {
25
- mid_price_above: string;
26
- }
27
- | {
28
- mid_price_below: string;
29
- };
7
+ import { TriggerServerTriggerCriteria } from './serverModelTypes';
30
8
 
31
9
  export interface TriggerServerPlaceOrderParams {
32
10
  id: number | null;
@@ -37,6 +15,7 @@ export interface TriggerServerPlaceOrderParams {
37
15
  digest: string | null;
38
16
  // Trigger service defaults this to true
39
17
  spot_leverage: boolean | null;
18
+ borrow_margin: boolean | null;
40
19
  }
41
20
 
42
21
  export type TriggerServerCancelOrdersParams =
@@ -0,0 +1,55 @@
1
+ export interface TriggerServerDependency {
2
+ digest: string;
3
+ /**
4
+ * Whether to trigger on partial fills.
5
+ */
6
+ on_partial_fill: boolean;
7
+ }
8
+
9
+ export type TriggerServerPriceRequirement =
10
+ // These trigger on fast oracle price
11
+ | {
12
+ oracle_price_above: string;
13
+ }
14
+ | {
15
+ oracle_price_below: string;
16
+ }
17
+ // These trigger on last trade price
18
+ | {
19
+ last_price_above: string;
20
+ }
21
+ | {
22
+ last_price_below: string;
23
+ }
24
+ // These trigger on mid-book price
25
+ | {
26
+ mid_price_above: string;
27
+ }
28
+ | {
29
+ mid_price_below: string;
30
+ };
31
+
32
+ export interface TriggerServerPriceTriggerCriteria {
33
+ price_requirement: TriggerServerPriceRequirement;
34
+ dependency?: TriggerServerDependency;
35
+ }
36
+
37
+ export interface TriggerServerTimeTriggerCriteria {
38
+ /**
39
+ * Trigger interval in seconds
40
+ */
41
+ interval: string;
42
+ /**
43
+ * By default, trigger service will split up orders as per total amount / interval
44
+ * If you want to specify the amounts for each interval, you can provide them here.
45
+ */
46
+ amounts?: string[];
47
+ }
48
+
49
+ export type TriggerServerTriggerCriteria =
50
+ | {
51
+ price_trigger: TriggerServerPriceTriggerCriteria;
52
+ }
53
+ | {
54
+ time_trigger: TriggerServerTimeTriggerCriteria;
55
+ };
@@ -1,4 +1,4 @@
1
- import { EIP712ListTriggerOrdersValues, SignedTx } from '@nadohq/contracts';
1
+ import { EIP712ListTriggerOrdersValues, SignedTx } from '@nadohq/shared';
2
2
  import { EngineServerExecuteResult } from '@nadohq/engine-client';
3
3
  import { TriggerServerPlaceOrderParams } from './serverExecuteTypes';
4
4
 
@@ -21,6 +21,8 @@ export type TriggerServerOrderStatus =
21
21
  * Request types
22
22
  */
23
23
 
24
+ export type TriggerServerTriggerTypeFilter = 'price_trigger' | 'twap';
25
+
24
26
  export interface TriggerServerListTriggerOrdersParams
25
27
  extends SignedTx<EIP712ListTriggerOrdersValues> {
26
28
  pending: boolean;
@@ -29,6 +31,8 @@ export interface TriggerServerListTriggerOrdersParams
29
31
  max_update_time?: number;
30
32
  digests?: string[];
31
33
  limit?: number;
34
+ trigger_types?: TriggerServerTriggerTypeFilter[];
35
+ reduce_only?: boolean;
32
36
  }
33
37
 
34
38
  export interface TriggerServerQueryRequestByType {