@velora-dex/sdk 9.3.5 → 9.3.6
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/dist/methods/delta/getDeltaPrice.d.ts +5 -1
- package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -1
- package/dist/methods/delta/index.d.ts +1 -0
- package/dist/methods/delta/index.d.ts.map +1 -1
- package/dist/methods/delta/postDeltaOrder.d.ts +3 -1
- package/dist/methods/delta/postDeltaOrder.d.ts.map +1 -1
- package/dist/methods/swap/rates.d.ts +1 -0
- package/dist/methods/swap/rates.d.ts.map +1 -1
- package/dist/methods/swap/transaction.d.ts +1 -0
- package/dist/methods/swap/transaction.d.ts.map +1 -1
- package/dist/sdk.cjs.development.js +32 -24
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +32 -24
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/methods/delta/getDeltaPrice.ts +9 -1
- package/src/methods/delta/index.ts +2 -0
- package/src/methods/delta/postDeltaOrder.ts +12 -3
- package/src/methods/swap/rates.ts +2 -0
- package/src/methods/swap/transaction.ts +1 -0
package/package.json
CHANGED
|
@@ -34,6 +34,9 @@ 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;
|
|
39
|
+
maxUSDImpact?: number;
|
|
37
40
|
|
|
38
41
|
includeAgents?: string[];
|
|
39
42
|
excludeAgents?: string[];
|
|
@@ -42,6 +45,7 @@ export type DeltaPriceParams = {
|
|
|
42
45
|
|
|
43
46
|
/** @description Allow swap on destChain after bridge. Default is true. */
|
|
44
47
|
allowBridgeAndSwap?: boolean;
|
|
48
|
+
degenMode?: boolean;
|
|
45
49
|
};
|
|
46
50
|
|
|
47
51
|
type DeltaPriceQueryOptions = Omit<
|
|
@@ -89,6 +93,10 @@ export type DeltaPrice = {
|
|
|
89
93
|
|
|
90
94
|
type AvailableBridgePrice = Pick<
|
|
91
95
|
DeltaPrice,
|
|
96
|
+
| 'srcAmount'
|
|
97
|
+
| 'srcAmountBeforeFee' // Available for BUY side
|
|
98
|
+
| 'srcUSD'
|
|
99
|
+
| 'srcUSDBeforeFee' // Available for BUY side
|
|
92
100
|
| 'destToken'
|
|
93
101
|
| 'destAmount'
|
|
94
102
|
| 'destAmountBeforeFee' // Available for SELL side
|
|
@@ -195,7 +203,7 @@ export const constructGetDeltaPrice = ({
|
|
|
195
203
|
excludeBridges: excludeBridgesString,
|
|
196
204
|
});
|
|
197
205
|
|
|
198
|
-
const fetchURL = `${pricesUrl}
|
|
206
|
+
const fetchURL = `${pricesUrl}${search}` as const;
|
|
199
207
|
|
|
200
208
|
const data = await fetcher<DeltaPriceResponse>({
|
|
201
209
|
url: fetchURL,
|
|
@@ -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 = (
|
|
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:
|
|
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>;
|