@velora-dex/sdk 9.5.4-dev.0 → 9.5.4-dev.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velora-dex/sdk",
3
- "version": "9.5.4-dev.0",
3
+ "version": "9.5.4-dev.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/sdk.esm.js",
6
6
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -147,6 +147,7 @@ import type {
147
147
  BridgeStatus,
148
148
  Bridge,
149
149
  ExternalDeltaOrder,
150
+ ProductiveDeltaOrder,
150
151
  TWAPDeltaOrder,
151
152
  TWAPBuyDeltaOrder,
152
153
  TWAPOnChainOrderType,
@@ -161,6 +162,7 @@ import type {
161
162
  DeltaAuctionTWAP,
162
163
  DeltaAuctionTWAPBuy,
163
164
  DeltaAuctionExternal,
165
+ DeltaAuctionProductive,
164
166
  DeltaOrderUnion,
165
167
  DeltaAuctionUnion,
166
168
  UnifiedDeltaOrderData,
@@ -569,6 +571,7 @@ export type {
569
571
  DeltaAuctionTWAP,
570
572
  DeltaAuctionTWAPBuy,
571
573
  DeltaAuctionExternal,
574
+ DeltaAuctionProductive,
572
575
  DeltaOrderUnion,
573
576
  DeltaAuctionUnion,
574
577
  UnifiedDeltaOrderData,
@@ -604,6 +607,8 @@ export type {
604
607
  DepositNativeAndPreSignDeltaOrderParams,
605
608
  // External Delta types
606
609
  ExternalDeltaOrder,
610
+ // Productive Delta types
611
+ ProductiveDeltaOrder,
607
612
  TWAPDeltaOrder,
608
613
  TWAPBuyDeltaOrder,
609
614
  TWAPOnChainOrderType,
@@ -11,6 +11,7 @@ import {
11
11
  ExternalDeltaOrder,
12
12
  OnChainOrderType,
13
13
  OrderKind,
14
+ ProductiveDeltaOrder,
14
15
  SwapSideUnion,
15
16
  TWAPBuyDeltaOrder,
16
17
  TWAPDeltaOrder,
@@ -65,6 +66,16 @@ function isDeltaOrder(order: DeltaOrderUnion): order is DeltaAuctionOrder {
65
66
  );
66
67
  }
67
68
 
69
+ /**
70
+ * @description Checks whether an order is a Productive Delta order
71
+ * (strategy-routed order without an explicit OrderKind).
72
+ */
73
+ function isProductiveOrder(
74
+ order: DeltaOrderUnion
75
+ ): order is ProductiveDeltaOrder {
76
+ return 'strategy' in order && typeof order.strategy === 'string';
77
+ }
78
+
68
79
  /**
69
80
  * @description Checks whether an auction is a TWAP auction.
70
81
  */
@@ -110,17 +121,28 @@ function isExternalAuction<T extends OnChainOrderType>(auction: {
110
121
  return auction.onChainOrderType === 'ExternalOrder';
111
122
  }
112
123
 
124
+ /**
125
+ * @description Checks whether an auction is a Productive auction.
126
+ */
127
+ function isProductiveAuction<T extends OnChainOrderType>(auction: {
128
+ onChainOrderType: T;
129
+ }): auction is { onChainOrderType: 'ProductiveOrder' & T } {
130
+ return auction.onChainOrderType === 'ProductiveOrder';
131
+ }
132
+
113
133
  const checks = {
114
134
  isTWAPOrder,
115
135
  isTWAPSellOrder,
116
136
  isTWAPBuyOrder,
117
137
  isExternalOrder,
118
138
  isDeltaOrder,
139
+ isProductiveOrder,
119
140
  isTWAPAuction,
120
141
  isTWAPSellAuction,
121
142
  isTWAPBuyAuction,
122
143
  isDeltaAuction,
123
144
  isExternalAuction,
145
+ isProductiveAuction,
124
146
  isOrderCrosschain,
125
147
  isExecutedAuction,
126
148
  isPartiallyExecutedAuction,
@@ -271,6 +293,10 @@ function getAuctionSwapSide(auction: DeltaAuction): SwapSideUnion {
271
293
  // TWAP orders have onChainOrderType instead of kind
272
294
  return getSwapSideFromTwapOrderType(auction.onChainOrderType);
273
295
  }
296
+ if (isProductiveAuction(auction)) {
297
+ // ProductiveOrders don't carry an explicit OrderKind; treated as SELL.
298
+ return 'SELL';
299
+ }
274
300
  return getSwapSideFromDeltaOrder(auction.order);
275
301
  }
276
302
 
@@ -123,6 +123,41 @@ export type ExternalDeltaOrder = {
123
123
  data: string;
124
124
  };
125
125
 
126
+ export type ProductiveDeltaOrder = {
127
+ /** @description The address of the order owner */
128
+ owner: string;
129
+ /** @description The address of the order beneficiary */
130
+ beneficiary: string;
131
+ /** @description The address of the src token */
132
+ srcToken: string;
133
+ /** @description The address of the dest token */
134
+ destToken: string;
135
+ /** @description The amount of src token to swap */
136
+ srcAmount: string;
137
+ /** @description The minimum amount of dest token to receive */
138
+ destAmount: string;
139
+ /** @description The expected amount of token to receive */
140
+ expectedAmount: string;
141
+ /** @description The deadline for the order */
142
+ deadline: number;
143
+ /** @description The nonce of the order */
144
+ nonce: string;
145
+ /** @description Metadata for the order, hex string */
146
+ metadata: string;
147
+ /** @description Encoded partner address, fee bps, and flags for the order. partnerAndFee = (partner << 96) | (partnerTakesSurplus << 8) | fee in bps (max fee is 2%) */
148
+ partnerAndFee: string;
149
+ /** @description Optional permit signature for the src token */
150
+ permit: string;
151
+ /** @description The strategy address. */
152
+ strategy: string;
153
+ /** @description The number of shares to execute for this order. */
154
+ shares: string;
155
+ /** @description Whether the order uses shares or raw amounts. */
156
+ useShares: boolean;
157
+ /** @description The bridge input */
158
+ bridge: Bridge;
159
+ };
160
+
126
161
  type TWAPDeltaOrderBase = {
127
162
  /** @description The address of the order owner */
128
163
  owner: string;
@@ -216,6 +251,7 @@ export type OnChainOrderMap = {
216
251
  ExternalOrder: ExternalDeltaOrder;
217
252
  TWAPOrder: TWAPDeltaOrder;
218
253
  TWAPBuyOrder: TWAPBuyDeltaOrder;
254
+ ProductiveOrder: ProductiveDeltaOrder;
219
255
  };
220
256
 
221
257
  type BaseBridgeAuctionFields = Pick<
@@ -228,6 +264,7 @@ type BridgeAuctionFiledsMap = {
228
264
  ExternalOrder: BaseBridgeAuctionFields;
229
265
  TWAPOrder: Record<keyof BaseBridgeAuctionFields, null>;
230
266
  TWAPBuyOrder: Record<keyof BaseBridgeAuctionFields, null>;
267
+ ProductiveOrder: BaseBridgeAuctionFields;
231
268
  };
232
269
 
233
270
  type DeltaAuctionBase = {
@@ -256,7 +293,7 @@ type DeltaAuctionBase = {
256
293
  };
257
294
 
258
295
  export type DeltaAuction<
259
- T extends keyof OnChainOrderMap = keyof OnChainOrderMap
296
+ T extends keyof OnChainOrderMap = keyof OnChainOrderMap,
260
297
  > = T extends T
261
298
  ? Prettify<
262
299
  DeltaAuctionBase & {
@@ -270,12 +307,14 @@ export type DeltaAuctionDelta = DeltaAuction<'Order'>;
270
307
  export type DeltaAuctionExternal = DeltaAuction<'ExternalOrder'>;
271
308
  export type DeltaAuctionTWAP = DeltaAuction<'TWAPOrder'>;
272
309
  export type DeltaAuctionTWAPBuy = DeltaAuction<'TWAPBuyOrder'>;
310
+ export type DeltaAuctionProductive = DeltaAuction<'ProductiveOrder'>;
273
311
 
274
312
  export type DeltaAuctionUnion =
275
313
  | DeltaAuctionDelta
276
314
  | DeltaAuctionExternal
277
315
  | DeltaAuctionTWAP
278
- | DeltaAuctionTWAPBuy;
316
+ | DeltaAuctionTWAPBuy
317
+ | DeltaAuctionProductive;
279
318
 
280
319
  export type DeltaOrderUnion = OnChainOrderMap[keyof OnChainOrderMap];
281
320