@velora-dex/sdk 9.3.4-dev.4 → 9.3.5-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.3.4-dev.4",
3
+ "version": "9.3.5-dev.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/sdk.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -8,14 +8,13 @@ import { sanitizeDeltaOrderData } from './helpers/misc';
8
8
  import { SignableDeltaOrderData } from './helpers/buildDeltaOrderData';
9
9
  import { produceDeltaOrderHash } from './preSignDeltaOrder';
10
10
  import type { ExtractAbiMethodNames } from '../../helpers/misc';
11
- import type { Bridge, DeltaAuctionOrder } from './helpers/types';
11
+ import type { DeltaAuctionOrder } from './helpers/types';
12
12
  import { DEFAULT_BRIDGE } from './constants';
13
13
 
14
14
  export type CancelAndWithdrawDeltaOrderParams = {
15
15
  order: DeltaAuctionOrder;
16
16
  signature: string;
17
- bridgeOverride?: Pick<Bridge, 'protocolSelector' | 'protocolData'>;
18
- cosignature?: string;
17
+ /** @description A boolean indicating whether the order is a fillable order. False by default */
19
18
  isFillable?: boolean;
20
19
  };
21
20
 
@@ -260,16 +259,7 @@ export const constructDeltaTokenModule = <T>(
260
259
  const { getDeltaContract } = constructGetDeltaContract(options);
261
260
 
262
261
  const cancelAndWithdrawDeltaOrder: CancelAndWithdrawDeltaOrder<T> = async (
263
- {
264
- order,
265
- signature,
266
- bridgeOverride = {
267
- protocolData: DEFAULT_BRIDGE.protocolData,
268
- protocolSelector: DEFAULT_BRIDGE.protocolSelector,
269
- },
270
- cosignature = '0x',
271
- isFillable = false,
272
- },
262
+ { order, signature, isFillable = false },
273
263
  overrides = {},
274
264
  requestParams
275
265
  ) => {
@@ -281,8 +271,13 @@ export const constructDeltaTokenModule = <T>(
281
271
  const orderWithSig = {
282
272
  order,
283
273
  signature,
284
- bridgeOverride,
285
- cosignature,
274
+ // bridgeOverride and cosignature are not used by the contract,
275
+ // can always provide defaults
276
+ bridgeOverride: {
277
+ protocolData: DEFAULT_BRIDGE.protocolData,
278
+ protocolSelector: DEFAULT_BRIDGE.protocolSelector,
279
+ },
280
+ cosignature: '0x',
286
281
  };
287
282
 
288
283
  const res = await options.contractCaller.transactCall<AvailableMethods>({
@@ -34,6 +34,8 @@ export type DeltaPriceParams = {
34
34
  destChainId?: number;
35
35
  /** @description SELL or BUY, default is SELL */
36
36
  side?: SwapSideUnion;
37
+ /** @description In %. It's a way to bypass the API price impact check (default = 15%) */
38
+ maxImpact?: number;
37
39
 
38
40
  includeAgents?: string[];
39
41
  excludeAgents?: string[];
@@ -42,6 +44,7 @@ export type DeltaPriceParams = {
42
44
 
43
45
  /** @description Allow swap on destChain after bridge. Default is true. */
44
46
  allowBridgeAndSwap?: boolean;
47
+ degenMode?: boolean;
45
48
  };
46
49
 
47
50
  type DeltaPriceQueryOptions = Omit<
@@ -60,6 +60,7 @@ export type SubmitDeltaOrderParams = BuildDeltaOrderDataParams & {
60
60
  partiallyFillable?: boolean;
61
61
  /** @description Referrer address */
62
62
  referrerAddress?: string;
63
+ degenMode?: boolean;
63
64
  } & Pick<DeltaOrderToPost, 'type' | 'includeAgents' | 'excludeAgents'>;
64
65
 
65
66
  type SubmitDeltaOrder = (
@@ -91,6 +92,7 @@ export const constructSubmitDeltaOrder = (
91
92
  type: orderParams.type,
92
93
  includeAgents: orderParams.includeAgents,
93
94
  excludeAgents: orderParams.excludeAgents,
95
+ degenMode: orderParams.degenMode,
94
96
  });
95
97
 
96
98
  return response;
@@ -1,4 +1,5 @@
1
1
  import { API_URL } from '../../constants';
2
+ import { constructSearchString } from '../../helpers/misc';
2
3
  import type { ConstructFetchInput, RequestParameters } from '../../types';
3
4
  import { DeltaAuctionOrder, DeltaAuction } from './helpers/types';
4
5
 
@@ -21,7 +22,9 @@ export type DeltaOrderToPost = {
21
22
  excludeAgents?: string[];
22
23
  };
23
24
 
24
- export type PostDeltaOrderParams = Omit<DeltaOrderToPost, 'chainId'>;
25
+ export type PostDeltaOrderParams = Omit<DeltaOrderToPost, 'chainId'> & {
26
+ degenMode?: boolean;
27
+ };
25
28
 
26
29
  export type DeltaOrderApiResponse = Omit<DeltaAuction, 'transactions'> & {
27
30
  orderVersion: string; // "2.0.0"
@@ -45,11 +48,17 @@ export const constructPostDeltaOrder = ({
45
48
  }: ConstructFetchInput): PostDeltaOrderFunctions => {
46
49
  const postOrderUrl = `${apiURL}/delta/orders` as const;
47
50
 
48
- const postDeltaOrder: PostDeltaOrder = (postData, requestParams) => {
51
+ const postDeltaOrder: PostDeltaOrder = (_postData, requestParams) => {
52
+ const { degenMode, ...postData } = _postData;
49
53
  const deltaOrderToPost: DeltaOrderToPost = { ...postData, chainId };
50
54
 
55
+ const search = constructSearchString<{ degenMode?: boolean }>({
56
+ degenMode,
57
+ });
58
+ const fetchURL = `${postOrderUrl}/${search}` as const;
59
+
51
60
  return fetcher<DeltaOrderApiResponse>({
52
- url: postOrderUrl,
61
+ url: fetchURL,
53
62
  method: 'POST',
54
63
  data: deltaOrderToPost,
55
64
  requestParams,
@@ -139,6 +139,7 @@ type RateQueryParams = {
139
139
  * @description Exclude all RFQs from pricing, e.g.: AugustusRFQ, Hashflow. Default: false
140
140
  */
141
141
  excludeRFQ?: boolean;
142
+ degenMode?: boolean;
142
143
  };
143
144
 
144
145
  // more details in the docs https://developers.velora.xyz/api/velora-api/velora-market-api/get-rate-for-a-token-pair#query-parameters
@@ -169,6 +170,7 @@ export type RateOptions = {
169
170
  srcTokenDexTransferFee?: string;
170
171
  /** @description Some tokens only charge tax when swapped in/out DEXs and not on ordinary transfers. */
171
172
  destTokenDexTransferFee?: string;
173
+ degenMode?: boolean;
172
174
  };
173
175
 
174
176
  type CommonGetRateInput = {
@@ -168,6 +168,7 @@ export type BuildOptionsBase = {
168
168
  ignoreAllowance?: boolean;
169
169
  /** @description Allows the API to return the contract parameters only. */
170
170
  onlyParams?: boolean;
171
+ degenMode?: boolean;
171
172
  };
172
173
 
173
174
  export type BuildOptionsWithGasPrice = BuildOptionsBase & Partial<WithGasPrice>;