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

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 (87) hide show
  1. package/dist/index.d.ts +4 -18
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/methods/delta/cancelDeltaOrder.d.ts.map +1 -1
  4. package/dist/methods/delta/getDeltaOrders.d.ts +4 -4
  5. package/dist/methods/delta/getDeltaOrders.d.ts.map +1 -1
  6. package/dist/methods/delta/getDeltaPrice.d.ts +1 -1
  7. package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -1
  8. package/dist/methods/delta/helpers/orders.d.ts +17 -16
  9. package/dist/methods/delta/helpers/orders.d.ts.map +1 -1
  10. package/dist/methods/delta/helpers/types.d.ts +11 -50
  11. package/dist/methods/delta/helpers/types.d.ts.map +1 -1
  12. package/dist/methods/delta/postDeltaOrder.d.ts +3 -3
  13. package/dist/methods/delta/postDeltaOrder.d.ts.map +1 -1
  14. package/dist/sdk/full.d.ts +0 -2
  15. package/dist/sdk/full.d.ts.map +1 -1
  16. package/dist/sdk/simple.d.ts +0 -10
  17. package/dist/sdk/simple.d.ts.map +1 -1
  18. package/dist/sdk.cjs.development.js +252 -1087
  19. package/dist/sdk.cjs.development.js.map +1 -1
  20. package/dist/sdk.cjs.production.min.js +1 -1
  21. package/dist/sdk.cjs.production.min.js.map +1 -1
  22. package/dist/sdk.esm.js +253 -1071
  23. package/dist/sdk.esm.js.map +1 -1
  24. package/dist/types.d.ts +0 -8
  25. package/dist/types.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/src/constants.js +6 -1
  28. package/src/index.js +115 -86
  29. package/src/index.ts +0 -153
  30. package/src/methods/delta/cancelDeltaOrder.ts +1 -4
  31. package/src/methods/delta/getDeltaOrders.ts +5 -6
  32. package/src/methods/delta/getDeltaPrice.ts +1 -1
  33. package/src/methods/delta/helpers/orders.ts +19 -27
  34. package/src/methods/delta/helpers/types.ts +19 -63
  35. package/src/methods/delta/postDeltaOrder.ts +4 -4
  36. package/src/methods/delta/postTWAPDeltaOrder.ts +1 -1
  37. package/src/sdk/full.ts +0 -8
  38. package/src/sdk/simple.ts +0 -56
  39. package/src/types.ts +0 -9
  40. package/dist/examples/deltaV2.d.ts +0 -2
  41. package/dist/examples/deltaV2.d.ts.map +0 -1
  42. package/dist/examples/helpers/deltaV2.d.ts +0 -5
  43. package/dist/examples/helpers/deltaV2.d.ts.map +0 -1
  44. package/dist/methods/deltaV2/buildDeltaOrderV2.d.ts +0 -44
  45. package/dist/methods/deltaV2/buildDeltaOrderV2.d.ts.map +0 -1
  46. package/dist/methods/deltaV2/buildExternalDeltaOrderV2.d.ts +0 -48
  47. package/dist/methods/deltaV2/buildExternalDeltaOrderV2.d.ts.map +0 -1
  48. package/dist/methods/deltaV2/buildTWAPDeltaOrderV2.d.ts +0 -59
  49. package/dist/methods/deltaV2/buildTWAPDeltaOrderV2.d.ts.map +0 -1
  50. package/dist/methods/deltaV2/cancelDeltaOrderV2.d.ts +0 -21
  51. package/dist/methods/deltaV2/cancelDeltaOrderV2.d.ts.map +0 -1
  52. package/dist/methods/deltaV2/getAgentsListV2.d.ts +0 -10
  53. package/dist/methods/deltaV2/getAgentsListV2.d.ts.map +0 -1
  54. package/dist/methods/deltaV2/getBridgeRoutes.d.ts +0 -20
  55. package/dist/methods/deltaV2/getBridgeRoutes.d.ts.map +0 -1
  56. package/dist/methods/deltaV2/getDeltaOrdersV2.d.ts +0 -33
  57. package/dist/methods/deltaV2/getDeltaOrdersV2.d.ts.map +0 -1
  58. package/dist/methods/deltaV2/getDeltaPriceV2.d.ts +0 -46
  59. package/dist/methods/deltaV2/getDeltaPriceV2.d.ts.map +0 -1
  60. package/dist/methods/deltaV2/index.d.ts +0 -59
  61. package/dist/methods/deltaV2/index.d.ts.map +0 -1
  62. package/dist/methods/deltaV2/isTokenSupportedInDeltaV2.d.ts +0 -8
  63. package/dist/methods/deltaV2/isTokenSupportedInDeltaV2.d.ts.map +0 -1
  64. package/dist/methods/deltaV2/postDeltaOrderV2.d.ts +0 -28
  65. package/dist/methods/deltaV2/postDeltaOrderV2.d.ts.map +0 -1
  66. package/dist/methods/deltaV2/postExternalDeltaOrderV2.d.ts +0 -11
  67. package/dist/methods/deltaV2/postExternalDeltaOrderV2.d.ts.map +0 -1
  68. package/dist/methods/deltaV2/postTWAPDeltaOrderV2.d.ts +0 -16
  69. package/dist/methods/deltaV2/postTWAPDeltaOrderV2.d.ts.map +0 -1
  70. package/dist/methods/deltaV2/types.d.ts +0 -163
  71. package/dist/methods/deltaV2/types.d.ts.map +0 -1
  72. package/src/examples/deltaV2.ts +0 -200
  73. package/src/examples/helpers/deltaV2.ts +0 -29
  74. package/src/methods/deltaV2/buildDeltaOrderV2.ts +0 -86
  75. package/src/methods/deltaV2/buildExternalDeltaOrderV2.ts +0 -95
  76. package/src/methods/deltaV2/buildTWAPDeltaOrderV2.ts +0 -131
  77. package/src/methods/deltaV2/cancelDeltaOrderV2.ts +0 -103
  78. package/src/methods/deltaV2/getAgentsListV2.ts +0 -34
  79. package/src/methods/deltaV2/getBridgeRoutes.ts +0 -82
  80. package/src/methods/deltaV2/getDeltaOrdersV2.ts +0 -119
  81. package/src/methods/deltaV2/getDeltaPriceV2.ts +0 -108
  82. package/src/methods/deltaV2/index.ts +0 -303
  83. package/src/methods/deltaV2/isTokenSupportedInDeltaV2.ts +0 -52
  84. package/src/methods/deltaV2/postDeltaOrderV2.ts +0 -65
  85. package/src/methods/deltaV2/postExternalDeltaOrderV2.ts +0 -45
  86. package/src/methods/deltaV2/postTWAPDeltaOrderV2.ts +0 -63
  87. package/src/methods/deltaV2/types.ts +0 -189
@@ -11,7 +11,6 @@ import {
11
11
  ExternalDeltaOrder,
12
12
  OnChainOrderType,
13
13
  OrderKind,
14
- ProductiveDeltaOrder,
15
14
  SwapSideUnion,
16
15
  TWAPBuyDeltaOrder,
17
16
  TWAPDeltaOrder,
@@ -66,16 +65,6 @@ function isDeltaOrder(order: DeltaOrderUnion): order is DeltaAuctionOrder {
66
65
  );
67
66
  }
68
67
 
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
-
79
68
  /**
80
69
  * @description Checks whether an auction is a TWAP auction.
81
70
  */
@@ -121,28 +110,17 @@ function isExternalAuction<T extends OnChainOrderType>(auction: {
121
110
  return auction.onChainOrderType === 'ExternalOrder';
122
111
  }
123
112
 
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
-
133
113
  const checks = {
134
114
  isTWAPOrder,
135
115
  isTWAPSellOrder,
136
116
  isTWAPBuyOrder,
137
117
  isExternalOrder,
138
118
  isDeltaOrder,
139
- isProductiveOrder,
140
119
  isTWAPAuction,
141
120
  isTWAPSellAuction,
142
121
  isTWAPBuyAuction,
143
122
  isDeltaAuction,
144
123
  isExternalAuction,
145
- isProductiveAuction,
146
124
  isOrderCrosschain,
147
125
  isExecutedAuction,
148
126
  isPartiallyExecutedAuction,
@@ -217,10 +195,12 @@ function getTwapAuctionAmounts(
217
195
  return {
218
196
  final,
219
197
  expected,
198
+ minimal: expected, // TWAP orders don't have more detailed amounts
220
199
  };
221
200
  }
222
201
  return {
223
202
  expected,
203
+ minimal: expected, // TWAP orders don't have more detailed amounts
224
204
  };
225
205
  }
226
206
 
@@ -293,10 +273,6 @@ function getAuctionSwapSide(auction: DeltaAuction): SwapSideUnion {
293
273
  // TWAP orders have onChainOrderType instead of kind
294
274
  return getSwapSideFromTwapOrderType(auction.onChainOrderType);
295
275
  }
296
- if (isProductiveAuction(auction)) {
297
- // ProductiveOrders don't carry an explicit OrderKind; treated as SELL.
298
- return 'SELL';
299
- }
300
276
  return getSwapSideFromDeltaOrder(auction.order);
301
277
  }
302
278
 
@@ -309,7 +285,7 @@ function getUnifiedDeltaOrderData(
309
285
  const { order, chainId } = auction;
310
286
 
311
287
  const { srcToken, destToken } = getOrderTokenAddresses(order);
312
- const { expected, final } = getAuctionAmounts(auction);
288
+ const { expected, final, minimal } = getAuctionAmounts(auction);
313
289
 
314
290
  const srcChainId = chainId;
315
291
  const destChainId = getAuctionDestChainId({ order, chainId });
@@ -326,6 +302,7 @@ function getUnifiedDeltaOrderData(
326
302
  amounts: {
327
303
  expected,
328
304
  final,
305
+ minimal,
329
306
  },
330
307
  srcToken,
331
308
  destToken,
@@ -388,6 +365,11 @@ function getAuctionAmounts(auction: DeltaAuction) {
388
365
  destAmount: auction.order.expectedAmount || auction.order.destAmount,
389
366
  };
390
367
 
368
+ let minimal = {
369
+ srcAmount: auction.order.srcAmount,
370
+ destAmount: auction.order.destAmount,
371
+ };
372
+
391
373
  const order = auction.order;
392
374
 
393
375
  if (isOrderCrosschain(order)) {
@@ -398,6 +380,14 @@ function getAuctionAmounts(auction: DeltaAuction) {
398
380
  order.bridge.scalingFactor
399
381
  ).toString(),
400
382
  };
383
+
384
+ minimal = {
385
+ srcAmount: minimal.srcAmount,
386
+ destAmount: scaleByFactor(
387
+ BigInt(minimal.destAmount),
388
+ order.bridge.scalingFactor
389
+ ).toString(),
390
+ };
401
391
  }
402
392
 
403
393
  const isExecuted = isExecutedAuction(auction);
@@ -406,10 +396,12 @@ function getAuctionAmounts(auction: DeltaAuction) {
406
396
  return {
407
397
  final,
408
398
  expected,
399
+ minimal,
409
400
  };
410
401
  }
411
402
  return {
412
403
  expected,
404
+ minimal,
413
405
  };
414
406
  }
415
407
 
@@ -123,41 +123,6 @@ 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
-
161
126
  type TWAPDeltaOrderBase = {
162
127
  /** @description The address of the order owner */
163
128
  owner: string;
@@ -251,7 +216,6 @@ export type OnChainOrderMap = {
251
216
  ExternalOrder: ExternalDeltaOrder;
252
217
  TWAPOrder: TWAPDeltaOrder;
253
218
  TWAPBuyOrder: TWAPBuyDeltaOrder;
254
- ProductiveOrder: ProductiveDeltaOrder;
255
219
  };
256
220
 
257
221
  type BaseBridgeAuctionFields = Pick<
@@ -264,7 +228,6 @@ type BridgeAuctionFiledsMap = {
264
228
  ExternalOrder: BaseBridgeAuctionFields;
265
229
  TWAPOrder: Record<keyof BaseBridgeAuctionFields, null>;
266
230
  TWAPBuyOrder: Record<keyof BaseBridgeAuctionFields, null>;
267
- ProductiveOrder: BaseBridgeAuctionFields;
268
231
  };
269
232
 
270
233
  type DeltaAuctionBase = {
@@ -289,43 +252,35 @@ type DeltaAuctionBase = {
289
252
  bridgeMetadata: BridgeMetadata | null;
290
253
  bridgeStatus: BridgeStatus | null;
291
254
 
292
- type: DeltaOrderType;
255
+ type: 'MARKET' | 'LIMIT';
293
256
  };
294
257
 
295
- export type DeltaAuction<
296
- T extends keyof OnChainOrderMap = keyof OnChainOrderMap,
297
- > = T extends T
298
- ? Prettify<
299
- DeltaAuctionBase & {
300
- onChainOrderType: T;
301
- order: OnChainOrderMap[T];
302
- } & BridgeAuctionFiledsMap[T]
303
- >
304
- : never;
258
+ export type DeltaAuction<T extends OnChainOrderType = OnChainOrderType> =
259
+ T extends T
260
+ ? Prettify<
261
+ DeltaAuctionBase & {
262
+ onChainOrderType: T;
263
+ order: OnChainOrderMap[T];
264
+ } & BridgeAuctionFiledsMap[T]
265
+ >
266
+ : never;
305
267
 
306
268
  export type DeltaAuctionDelta = DeltaAuction<'Order'>;
307
269
  export type DeltaAuctionExternal = DeltaAuction<'ExternalOrder'>;
308
270
  export type DeltaAuctionTWAP = DeltaAuction<'TWAPOrder'>;
309
271
  export type DeltaAuctionTWAPBuy = DeltaAuction<'TWAPBuyOrder'>;
310
- export type DeltaAuctionProductive = DeltaAuction<'ProductiveOrder'>;
311
272
 
312
273
  export type DeltaAuctionUnion =
313
274
  | DeltaAuctionDelta
314
275
  | DeltaAuctionExternal
315
276
  | DeltaAuctionTWAP
316
- | DeltaAuctionTWAPBuy
317
- | DeltaAuctionProductive;
277
+ | DeltaAuctionTWAPBuy;
318
278
 
319
279
  export type DeltaOrderUnion = OnChainOrderMap[keyof OnChainOrderMap];
320
280
 
321
281
  export type BridgeMetadata = {
322
- /** @description Actual amount received on the destination chain. */
282
+ /** @description The amount that user should expect to get */
323
283
  outputAmount: string;
324
- /** @description Field is present iff: order was built via POST /v2/orders/build,
325
- * the route is cross-chain (route.bridge !== null and not an external handler),
326
- * and the order is posted before the per-order cache entry expires.
327
- */
328
- expectedOutputAmount?: string;
329
284
  /** @description The cross-chain deadline. If deadline passes, the bridgeStatus would be expired */
330
285
  fillDeadline?: number; // available for Across protocol
331
286
  /** @description The deposit id */
@@ -343,14 +298,10 @@ export type OnChainOrderType =
343
298
  | 'Order'
344
299
  | 'ExternalOrder'
345
300
  | 'TWAPOrder'
346
- | 'TWAPBuyOrder'
347
- | 'ProductiveOrder';
301
+ | 'TWAPBuyOrder';
348
302
 
349
303
  export type TWAPOnChainOrderType = 'TWAPOrder' | 'TWAPBuyOrder';
350
304
 
351
- /** @description Order kind: MARKET (immediate) vs LIMIT (rate-pegged). */
352
- export type DeltaOrderType = 'MARKET' | 'LIMIT';
353
-
354
305
  //// available on BridgePrice ////
355
306
 
356
307
  type BridgeQuoteFee = {
@@ -379,7 +330,12 @@ export type UnifiedDeltaOrderData = {
379
330
  srcAmount: string;
380
331
  destAmount: string;
381
332
  };
382
- /** @description final amounts after Order execution. May be less than expected if there is slippage or only partial execution was achieved */
333
+ /** @description minimal amounts that user should receive if the order is filled, known at the start of Order execution */
334
+ minimal: {
335
+ srcAmount: string;
336
+ destAmount: string;
337
+ };
338
+ /** @description final amounts after Order execution. May be less than expected if there is slippage or only partial execution was achieved */
383
339
  final?: {
384
340
  srcAmount: string;
385
341
  destAmount: string;
@@ -3,11 +3,11 @@ import { constructSearchString } from '../../helpers/misc';
3
3
  import type { ConstructFetchInput, RequestParameters } from '../../types';
4
4
  import type {
5
5
  DeltaAuction,
6
- DeltaOrderType,
7
6
  OnChainOrderMap,
7
+ OnChainOrderType,
8
8
  } from './helpers/types';
9
9
 
10
- export type DeltaOrderToPost<T extends keyof OnChainOrderMap = 'Order'> = {
10
+ export type DeltaOrderToPost<T extends OnChainOrderType = 'Order'> = {
11
11
  /** @description Partner string */
12
12
  partner?: string;
13
13
  /** @description Referrer address */
@@ -20,7 +20,7 @@ export type DeltaOrderToPost<T extends keyof OnChainOrderMap = 'Order'> = {
20
20
  partiallyFillable?: boolean;
21
21
 
22
22
  /** @description Type of the order. MARKET or LIMIT. Default is MARKET */
23
- type?: DeltaOrderType;
23
+ type?: 'MARKET' | 'LIMIT';
24
24
 
25
25
  includeAgents?: string[];
26
26
  excludeAgents?: string[];
@@ -53,7 +53,7 @@ export const constructPostDeltaOrder = ({
53
53
  const search = constructSearchString<{ degenMode?: boolean }>({
54
54
  degenMode,
55
55
  });
56
- const fetchURL = `${postOrderUrl}${search}` as const;
56
+ const fetchURL = `${postOrderUrl}/${search}` as const;
57
57
 
58
58
  return fetcher<DeltaAuction<'Order'>>({
59
59
  url: fetchURL,
@@ -43,7 +43,7 @@ export const constructPostTWAPDeltaOrder = ({
43
43
  degenMode,
44
44
  });
45
45
 
46
- const fetchURL = `${postOrderUrl}${search}` as const;
46
+ const fetchURL = `${postOrderUrl}/${search}` as const;
47
47
 
48
48
  return fetcher<DeltaAuction<'TWAPOrder'> | DeltaAuction<'TWAPBuyOrder'>>({
49
49
  url: fetchURL,
package/src/sdk/full.ts CHANGED
@@ -12,10 +12,6 @@ import {
12
12
  constructAllDeltaOrdersHandlers,
13
13
  DeltaOrderHandlers,
14
14
  } from '../methods/delta';
15
- import {
16
- constructAllDeltaV2OrdersHandlers,
17
- DeltaV2OrderHandlers,
18
- } from '../methods/deltaV2';
19
15
  import {
20
16
  constructGetQuote,
21
17
  GetQuoteFunctions,
@@ -30,7 +26,6 @@ export type AllSDKMethods<TxResponse> = {
30
26
  /** @deprecated NFT Orders are deprecated and will be removed in a future version. */
31
27
  nftOrders: NFTOrderHandlers<TxResponse>;
32
28
  delta: DeltaOrderHandlers<TxResponse>;
33
- deltaV2: DeltaV2OrderHandlers<TxResponse>;
34
29
  quote: GetQuoteFunctions;
35
30
  } & Required<ConstructBaseInput>;
36
31
 
@@ -46,8 +41,6 @@ export const constructFullSDK = <TxResponse = any>(
46
41
  constructAllNFTOrdersHandlers(config);
47
42
  const delta: DeltaOrderHandlers<TxResponse> =
48
43
  constructAllDeltaOrdersHandlers(config);
49
- const deltaV2: DeltaV2OrderHandlers<TxResponse> =
50
- constructAllDeltaV2OrdersHandlers(config);
51
44
  const quote = constructGetQuote(config);
52
45
 
53
46
  return {
@@ -55,7 +48,6 @@ export const constructFullSDK = <TxResponse = any>(
55
48
  limitOrders,
56
49
  nftOrders,
57
50
  delta,
58
- deltaV2,
59
51
  quote,
60
52
  apiURL: config.apiURL ?? API_URL,
61
53
  chainId: config.chainId,
package/src/sdk/simple.ts CHANGED
@@ -136,34 +136,6 @@ import {
136
136
  constructIsTokenSupportedInDelta,
137
137
  IsTokenSupportedInDeltaFunctions,
138
138
  } from '../methods/delta/isTokenSupportedInDelta';
139
- import {
140
- constructAllDeltaV2OrdersHandlers,
141
- DeltaV2OrderHandlers,
142
- } from '../methods/deltaV2';
143
- import {
144
- BuildDeltaOrderV2Functions,
145
- constructBuildDeltaOrderV2,
146
- } from '../methods/deltaV2/buildDeltaOrderV2';
147
- import {
148
- constructPostDeltaOrderV2,
149
- PostDeltaOrderV2Functions,
150
- } from '../methods/deltaV2/postDeltaOrderV2';
151
- import {
152
- constructGetDeltaOrdersV2,
153
- GetDeltaOrdersV2Functions,
154
- } from '../methods/deltaV2/getDeltaOrdersV2';
155
- import {
156
- constructGetDeltaPriceV2,
157
- GetDeltaPriceV2Functions,
158
- } from '../methods/deltaV2/getDeltaPriceV2';
159
- import {
160
- constructGetBridgeRoutes,
161
- GetBridgeRoutesFunctions,
162
- } from '../methods/deltaV2/getBridgeRoutes';
163
- import {
164
- constructIsTokenSupportedInDeltaV2,
165
- IsTokenSupportedInDeltaV2Functions,
166
- } from '../methods/deltaV2/isTokenSupportedInDeltaV2';
167
139
 
168
140
  export type SwapFetchMethods = GetBalancesFunctions &
169
141
  GetTokensFunctions &
@@ -196,15 +168,6 @@ export type DeltaFetchMethods = BuildDeltaOrderFunctions &
196
168
  IsTokenSupportedInDeltaFunctions &
197
169
  PostDeltaOrderFunctions;
198
170
 
199
- export type DeltaV2FetchMethods = BuildDeltaOrderV2Functions &
200
- GetDeltaOrdersV2Functions &
201
- GetDeltaPriceV2Functions &
202
- GetDeltaContractFunctions &
203
- GetPartnerFeeFunctions &
204
- GetBridgeRoutesFunctions &
205
- IsTokenSupportedInDeltaV2Functions &
206
- PostDeltaOrderV2Functions;
207
-
208
171
  export type SimpleFetchSDK = {
209
172
  swap: SwapFetchMethods;
210
173
  /** @deprecated Limit Orders are deprecated and will be removed in a future version. */
@@ -212,7 +175,6 @@ export type SimpleFetchSDK = {
212
175
  /** @deprecated NFT Orders are deprecated and will be removed in a future version. */
213
176
  nftOrders: NFTOrdersFetchMethods;
214
177
  delta: DeltaFetchMethods;
215
- deltaV2: DeltaV2FetchMethods;
216
178
  quote: QuoteFetchMethods;
217
179
  } & Required<ConstructBaseInput>;
218
180
 
@@ -225,7 +187,6 @@ export type SimpleSDK = {
225
187
  /** @deprecated NFT Orders are deprecated and will be removed in a future version. */
226
188
  nftOrders: NFTOrderHandlers<TxHash>;
227
189
  delta: DeltaOrderHandlers<TxHash>;
228
- deltaV2: DeltaV2OrderHandlers<TxHash>;
229
190
  quote: QuoteFetchMethods;
230
191
  } & Required<ConstructBaseInput>;
231
192
 
@@ -337,18 +298,6 @@ export function constructSimpleSDK(
337
298
  constructIsTokenSupportedInDelta
338
299
  );
339
300
 
340
- const deltaV2 = constructPartialSDK(
341
- config,
342
- constructBuildDeltaOrderV2,
343
- constructPostDeltaOrderV2,
344
- constructGetDeltaOrdersV2,
345
- constructGetDeltaPriceV2,
346
- constructGetDeltaContract,
347
- constructGetPartnerFee,
348
- constructGetBridgeRoutes,
349
- constructIsTokenSupportedInDeltaV2
350
- );
351
-
352
301
  const quote = constructPartialSDK(config, constructGetQuote);
353
302
 
354
303
  return {
@@ -356,7 +305,6 @@ export function constructSimpleSDK(
356
305
  limitOrders,
357
306
  nftOrders,
358
307
  delta,
359
- deltaV2,
360
308
  quote,
361
309
  apiURL: options.apiURL ?? API_URL,
362
310
  chainId: options.chainId,
@@ -385,9 +333,6 @@ export function constructSimpleSDK(
385
333
  const delta: DeltaOrderHandlers<TxHash> =
386
334
  constructAllDeltaOrdersHandlers<TxHash>(config);
387
335
 
388
- const deltaV2: DeltaV2OrderHandlers<TxHash> =
389
- constructAllDeltaV2OrdersHandlers<TxHash>(config);
390
-
391
336
  const quote = constructGetQuote(config);
392
337
 
393
338
  return {
@@ -395,7 +340,6 @@ export function constructSimpleSDK(
395
340
  limitOrders,
396
341
  nftOrders,
397
342
  delta,
398
- deltaV2,
399
343
  quote,
400
344
  apiURL: options.apiURL ?? API_URL,
401
345
  chainId: options.chainId,
package/src/types.ts CHANGED
@@ -241,12 +241,3 @@ export interface JsonFragment {
241
241
  */
242
242
  readonly gas?: string;
243
243
  }
244
-
245
- /** @description Standard pagination envelope returned by paginated API endpoints. */
246
- export type PaginatedResponse<T> = {
247
- data: T[];
248
- total: number;
249
- page: number;
250
- limit: number;
251
- hasMore: boolean;
252
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=deltaV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deltaV2.d.ts","sourceRoot":"","sources":["../../src/examples/deltaV2.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { DeltaOrderV2Response } from '../..';
2
- type GetDeltaOrderV2Fn = () => Promise<DeltaOrderV2Response>;
3
- export declare function startStatusCheckV2(getDeltaOrder: GetDeltaOrderV2Fn): void;
4
- export {};
5
- //# sourceMappingURL=deltaV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deltaV2.d.ts","sourceRoot":"","sources":["../../../src/examples/helpers/deltaV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAQ7C,KAAK,iBAAiB,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAiB7D,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,iBAAiB,QAGlE"}
@@ -1,44 +0,0 @@
1
- import type { ConstructFetchInput, RequestParameters } from '../../types';
2
- import type { BuiltDeltaOrderV2, DeltaRoute } from './types';
3
- export type { BuiltDeltaOrderV2 } from './types';
4
- export type BuildDeltaOrderV2Params = {
5
- /** @description The address of the order owner */
6
- owner: string;
7
- /** @description The address of the order beneficiary. Defaults to owner. */
8
- beneficiary?: string;
9
- /** @description The deadline for the order (unix seconds) */
10
- deadline?: number;
11
- /** @description The nonce of the order. Random if omitted. */
12
- nonce?: string;
13
- /** @description Optional permit signature for the src token. Defaults to "0x". */
14
- permit?: string;
15
- /** @description Partner string. Passed to the server to resolve partner fee details. */
16
- partner?: string;
17
- /** @description Partner fee in basis points (bps), 50bps=0.5% */
18
- partnerFeeBps?: number;
19
- /** @description Partner address */
20
- partnerAddress?: string;
21
- /** @description Take surplus flag */
22
- partnerTakesSurplus?: boolean;
23
- /** @description Whether the surplus should be capped. True by default. */
24
- capSurplus?: boolean;
25
- /** @description Metadata for the order, hex string */
26
- metadata?: string;
27
- /** @description Designates the Order as partially fillable instead of fill-or-kill. Default false. */
28
- partiallyFillable?: boolean;
29
- /** @description DeltaRoute from getDeltaPriceV2 — either priceV2.route or any priceV2.alternatives[i] */
30
- route: DeltaRoute;
31
- /** @description Order side. SELL or BUY. */
32
- side: 'SELL' | 'BUY';
33
- /** @description Slippage in basis points (bps). 10000 = 100%, 50 = 0.5%. Default 0. */
34
- slippage?: number;
35
- /** @description If passed, the server will use this as SELL destAmount (as BUY srcAmount) and expectedAmount */
36
- limitAmount?: string;
37
- };
38
- type BuildDeltaOrderV2 = (buildOrderParams: BuildDeltaOrderV2Params, requestParams?: RequestParameters) => Promise<BuiltDeltaOrderV2>;
39
- export type BuildDeltaOrderV2Functions = {
40
- /** @description Build a Delta v2 order from a DeltaRoute via the server endpoint, ready to sign and post. */
41
- buildDeltaOrderV2: BuildDeltaOrderV2;
42
- };
43
- export declare const constructBuildDeltaOrderV2: (options: ConstructFetchInput) => BuildDeltaOrderV2Functions;
44
- //# sourceMappingURL=buildDeltaOrderV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildDeltaOrderV2.d.ts","sourceRoot":"","sources":["../../../src/methods/deltaV2/buildDeltaOrderV2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE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tC,CAAC;AAEF,eAAO,MAAM,0BAA0B,YAC5B,mBAAmB,KAC3B,0BAgCF,CAAC"}
@@ -1,48 +0,0 @@
1
- import type { ConstructFetchInput, RequestParameters } from '../../types';
2
- import type { BuiltDeltaOrderV2, DeltaRoute } from './types';
3
- export type { BuiltDeltaOrderV2 } from './types';
4
- export type BuildExternalDeltaOrderV2Params = {
5
- /** @description The address of the order owner */
6
- owner: string;
7
- /** @description The address of the external handler contract */
8
- handler: string;
9
- /** @description Protocol-specific encoded bytes for the external handler */
10
- data: string;
11
- /** @description The address of the order beneficiary. Defaults to owner. */
12
- beneficiary?: string;
13
- /** @description The deadline for the order (unix seconds) */
14
- deadline?: number;
15
- /** @description The nonce of the order. Random if omitted. */
16
- nonce?: string;
17
- /** @description Optional permit signature for the src token. Defaults to "0x". */
18
- permit?: string;
19
- /** @description Partner string. Passed to the server to resolve partner fee details. */
20
- partner?: string;
21
- /** @description Partner fee in basis points (bps), 50bps=0.5% */
22
- partnerFeeBps?: number;
23
- /** @description Partner address */
24
- partnerAddress?: string;
25
- /** @description Take surplus flag */
26
- partnerTakesSurplus?: boolean;
27
- /** @description Whether the surplus should be capped. True by default. */
28
- capSurplus?: boolean;
29
- /** @description Metadata for the order, hex string */
30
- metadata?: string;
31
- /** @description Designates the Order as partially fillable. Default false. */
32
- partiallyFillable?: boolean;
33
- /** @description DeltaRoute from getDeltaPriceV2 */
34
- route: DeltaRoute;
35
- /** @description Order side. SELL or BUY. */
36
- side: 'SELL' | 'BUY';
37
- /** @description Slippage in basis points (bps). Default 0. */
38
- slippage?: number;
39
- /** @description If passed, the server will use this as SELL destAmount (as BUY srcAmount) and expectedAmount */
40
- limitAmount?: string;
41
- };
42
- type BuildExternalDeltaOrderV2 = (buildOrderParams: BuildExternalDeltaOrderV2Params, requestParams?: RequestParameters) => Promise<BuiltDeltaOrderV2>;
43
- export type BuildExternalDeltaOrderV2Functions = {
44
- /** @description Build a Delta v2 External Order from a DeltaRoute via the server endpoint, ready to sign and post. */
45
- buildExternalDeltaOrderV2: BuildExternalDeltaOrderV2;
46
- };
47
- export declare const constructBuildExternalDeltaOrderV2: (options: ConstructFetchInput) => BuildExternalDeltaOrderV2Functions;
48
- //# sourceMappingURL=buildExternalDeltaOrderV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildExternalDeltaOrderV2.d.ts","sourceRoot":"","sources":["../../../src/methods/deltaV2/buildExternalDeltaOrderV2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,0EAA0E;IAC1E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,mDAAmD;IACnD,KAAK,EAAE,UAAU,CAAC;IAClB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gHAAgH;IAChH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,yBAAyB,GAAG,CAC/B,gBAAgB,EAAE,+BAA+B,EACjD,aAAa,CAAC,EAAE,iBAAiB,KAC9B,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEhC,MAAM,MAAM,kCAAkC,GAAG;IAC/C,sHAAsH;IACtH,yBAAyB,EAAE,yBAAyB,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,kCAAkC,YACpC,mBAAmB,KAC3B,kCAqCF,CAAC"}
@@ -1,59 +0,0 @@
1
- import type { ConstructFetchInput, RequestParameters } from '../../types';
2
- import type { BuiltDeltaOrderV2, DeltaRoute } from './types';
3
- export type { BuiltDeltaOrderV2 } from './types';
4
- type BuildTWAPDeltaOrderV2Base = {
5
- /** @description The address of the order owner */
6
- owner: string;
7
- /** @description The address of the order beneficiary. Defaults to owner. */
8
- beneficiary?: string;
9
- /** @description The deadline for the order (unix seconds) */
10
- deadline?: number;
11
- /** @description The nonce of the order. Random if omitted. */
12
- nonce?: string;
13
- /** @description Optional permit signature for the src token. Defaults to "0x". */
14
- permit?: string;
15
- /** @description Partner string. Passed to the server to resolve partner fee details. */
16
- partner?: string;
17
- /** @description Seconds between slice executions (min 60) */
18
- interval: number;
19
- /** @description Number of slices (min 2) */
20
- numSlices: number;
21
- /** @description Slippage in basis points (bps). 10000 = 100%, 50 = 0.5%. Default 0. */
22
- slippage?: number;
23
- /** @description DeltaRoute from getDeltaPriceV2 for a single slice */
24
- route: DeltaRoute;
25
- /** @description Partner fee in basis points (bps) */
26
- partnerFeeBps?: number;
27
- /** @description Partner address */
28
- partnerAddress?: string;
29
- /** @description Take surplus flag */
30
- partnerTakesSurplus?: boolean;
31
- /** @description Whether the surplus should be capped. True by default. */
32
- capSurplus?: boolean;
33
- /** @description Metadata for the order, hex string */
34
- metadata?: string;
35
- /** @description Designates the Order as partially fillable. Default false. */
36
- partiallyFillable?: boolean;
37
- /** @description If passed, the server will use this as SELL destAmount (as BUY srcAmount) and expectedAmount for each slice */
38
- limitAmount?: string;
39
- };
40
- export type BuildTWAPSellDeltaOrderV2Params = BuildTWAPDeltaOrderV2Base & {
41
- onChainOrderType: 'TWAPOrder';
42
- /** @description Total source token amount across all slices. route.origin.input.amount must equal floor(totalSrcAmount / numSlices). */
43
- totalSrcAmount: string;
44
- };
45
- export type BuildTWAPBuyDeltaOrderV2Params = BuildTWAPDeltaOrderV2Base & {
46
- onChainOrderType: 'TWAPBuyOrder';
47
- /** @description Total destination token amount to buy across all slices. route.origin.output.amount must equal floor(totalDestAmount / numSlices). */
48
- totalDestAmount: string;
49
- /** @description Maximum source token amount willing to spend across all slices. */
50
- maxSrcAmount: string;
51
- };
52
- export type BuildTWAPDeltaOrderV2Params = BuildTWAPSellDeltaOrderV2Params | BuildTWAPBuyDeltaOrderV2Params;
53
- type BuildTWAPDeltaOrderV2 = (buildOrderParams: BuildTWAPDeltaOrderV2Params, requestParams?: RequestParameters) => Promise<BuiltDeltaOrderV2>;
54
- export type BuildTWAPDeltaOrderV2Functions = {
55
- /** @description Build a Delta v2 TWAP Order (sell or buy) from a DeltaRoute via the server endpoint, ready to sign and post. */
56
- buildTWAPDeltaOrderV2: BuildTWAPDeltaOrderV2;
57
- };
58
- export declare const constructBuildTWAPDeltaOrderV2: (options: ConstructFetchInput) => BuildTWAPDeltaOrderV2Functions;
59
- //# sourceMappingURL=buildTWAPDeltaOrderV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildTWAPDeltaOrderV2.d.ts","sourceRoot":"","sources":["../../../src/methods/deltaV2/buildTWAPDeltaOrderV2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,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