diff --git a/package.json b/package.json index 3e7a847e..c6d73ff6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@velora-dex/sdk", - "version": "9.3.4", + "version": "9.3.5-dev.1", "main": "dist/index.js", "module": "dist/sdk.esm.js", "typings": "dist/index.d.ts", diff --git a/src/methods/delta/getDeltaPrice.ts b/src/methods/delta/getDeltaPrice.ts index 2d8327dd..270c23c2 100644 --- a/src/methods/delta/getDeltaPrice.ts +++ b/src/methods/delta/getDeltaPrice.ts @@ -34,6 +34,9 @@ export type DeltaPriceParams = { destChainId?: number; /** @description SELL or BUY, default is SELL */ side?: SwapSideUnion; + /** @description In %. It's a way to bypass the API price impact check (default = 15%) */ + maxImpact?: number; + maxUSDImpact?: number; includeAgents?: string[]; excludeAgents?: string[]; @@ -42,6 +45,7 @@ export type DeltaPriceParams = { /** @description Allow swap on destChain after bridge. Default is true. */ allowBridgeAndSwap?: boolean; + degenMode?: boolean; }; type DeltaPriceQueryOptions = Omit< @@ -195,7 +199,7 @@ export const constructGetDeltaPrice = ({ excludeBridges: excludeBridgesString, }); - const fetchURL = `${pricesUrl}/${search}` as const; + const fetchURL = `${pricesUrl}${search}` as const; const data = await fetcher({ url: fetchURL, diff --git a/src/methods/delta/index.ts b/src/methods/delta/index.ts index e18ebc63..f925e037 100644 --- a/src/methods/delta/index.ts +++ b/src/methods/delta/index.ts @@ -60,6 +60,7 @@ export type SubmitDeltaOrderParams = BuildDeltaOrderDataParams & { partiallyFillable?: boolean; /** @description Referrer address */ referrerAddress?: string; + degenMode?: boolean; } & Pick; type SubmitDeltaOrder = ( @@ -91,6 +92,7 @@ export const constructSubmitDeltaOrder = ( type: orderParams.type, includeAgents: orderParams.includeAgents, excludeAgents: orderParams.excludeAgents, + degenMode: orderParams.degenMode, }); return response; diff --git a/src/methods/delta/postDeltaOrder.ts b/src/methods/delta/postDeltaOrder.ts index 5c457ec0..b98a5bb0 100644 --- a/src/methods/delta/postDeltaOrder.ts +++ b/src/methods/delta/postDeltaOrder.ts @@ -1,4 +1,5 @@ import { API_URL } from '../../constants'; +import { constructSearchString } from '../../helpers/misc'; import type { ConstructFetchInput, RequestParameters } from '../../types'; import { DeltaAuctionOrder, DeltaAuction } from './helpers/types'; @@ -21,7 +22,9 @@ export type DeltaOrderToPost = { excludeAgents?: string[]; }; -export type PostDeltaOrderParams = Omit; +export type PostDeltaOrderParams = Omit & { + degenMode?: boolean; +}; export type DeltaOrderApiResponse = Omit & { orderVersion: string; // "2.0.0" @@ -45,11 +48,17 @@ export const constructPostDeltaOrder = ({ }: ConstructFetchInput): PostDeltaOrderFunctions => { const postOrderUrl = `${apiURL}/delta/orders` as const; - const postDeltaOrder: PostDeltaOrder = (postData, requestParams) => { + const postDeltaOrder: PostDeltaOrder = (_postData, requestParams) => { + const { degenMode, ...postData } = _postData; const deltaOrderToPost: DeltaOrderToPost = { ...postData, chainId }; + const search = constructSearchString<{ degenMode?: boolean }>({ + degenMode, + }); + const fetchURL = `${postOrderUrl}/${search}` as const; + return fetcher({ - url: postOrderUrl, + url: fetchURL, method: 'POST', data: deltaOrderToPost, requestParams, diff --git a/src/methods/swap/rates.ts b/src/methods/swap/rates.ts index 214e3d8f..7e0f1d38 100644 --- a/src/methods/swap/rates.ts +++ b/src/methods/swap/rates.ts @@ -139,6 +139,7 @@ type RateQueryParams = { * @description Exclude all RFQs from pricing, e.g.: AugustusRFQ, Hashflow. Default: false */ excludeRFQ?: boolean; + degenMode?: boolean; }; // 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 = { srcTokenDexTransferFee?: string; /** @description Some tokens only charge tax when swapped in/out DEXs and not on ordinary transfers. */ destTokenDexTransferFee?: string; + degenMode?: boolean; }; type CommonGetRateInput = { diff --git a/src/methods/swap/transaction.ts b/src/methods/swap/transaction.ts index 1662a985..74cfbce3 100644 --- a/src/methods/swap/transaction.ts +++ b/src/methods/swap/transaction.ts @@ -168,6 +168,7 @@ export type BuildOptionsBase = { ignoreAllowance?: boolean; /** @description Allows the API to return the contract parameters only. */ onlyParams?: boolean; + degenMode?: boolean; }; export type BuildOptionsWithGasPrice = BuildOptionsBase & Partial;