@velora-dex/sdk 9.3.0 → 9.3.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/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/methods/delta/getBridgeInfo.d.ts +1 -0
- package/dist/methods/delta/getBridgeInfo.d.ts.map +1 -1
- package/dist/methods/delta/getDeltaPrice.d.ts +3 -7
- package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -1
- package/dist/methods/delta/helpers/types.d.ts +3 -0
- package/dist/methods/delta/helpers/types.d.ts.map +1 -1
- package/dist/methods/quote/getQuote.d.ts +4 -0
- package/dist/methods/quote/getQuote.d.ts.map +1 -1
- package/dist/methods/swap/swapTx.d.ts +3 -3
- package/dist/sdk.cjs.development.js +5 -5
- 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 +5 -5
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/methods/delta/getBridgeInfo.ts +1 -0
- package/src/methods/delta/getDeltaPrice.ts +8 -6
- package/src/methods/delta/helpers/types.ts +3 -0
- package/src/methods/quote/getQuote.ts +4 -0
- package/src/methods/swap/adapters.ts +2 -2
- package/src/methods/swap/rates.ts +4 -4
- package/src/methods/swap/spender.ts +2 -2
- package/src/methods/swap/swapTx.ts +4 -4
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -174,6 +174,7 @@ import {
|
|
|
174
174
|
GetDeltaPriceFunctions,
|
|
175
175
|
DeltaPrice,
|
|
176
176
|
BridgePrice,
|
|
177
|
+
AvailableBridge,
|
|
177
178
|
DeltaPriceParams,
|
|
178
179
|
} from './methods/delta/getDeltaPrice';
|
|
179
180
|
import {
|
|
@@ -379,6 +380,7 @@ export type {
|
|
|
379
380
|
BridgeStatus,
|
|
380
381
|
Bridge,
|
|
381
382
|
BridgeInfo,
|
|
383
|
+
AvailableBridge,
|
|
382
384
|
BridgeProtocolResponse,
|
|
383
385
|
BuildDeltaOrderDataParams,
|
|
384
386
|
BuildDeltaOrderFunctions,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Prettify } from 'viem';
|
|
1
2
|
import { Bridge } from '../..';
|
|
2
3
|
import { API_URL, SwapSide } from '../../constants';
|
|
3
4
|
import { constructSearchString } from '../../helpers/misc';
|
|
@@ -105,14 +106,15 @@ type AvailableBridgePrice = Pick<
|
|
|
105
106
|
| 'gasCost'
|
|
106
107
|
| 'gasCostUSDBeforeFee'
|
|
107
108
|
| 'gasCostBeforeFee'
|
|
109
|
+
| 'receivedDestAmount'
|
|
110
|
+
| 'receivedDestAmountBeforeFee'
|
|
111
|
+
| 'receivedDestUSD'
|
|
112
|
+
| 'receivedDestUSDBeforeFee'
|
|
108
113
|
>;
|
|
109
114
|
|
|
110
|
-
type AvailableBridge =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
bridgeInfo: BridgePriceInfo;
|
|
114
|
-
}[];
|
|
115
|
-
};
|
|
115
|
+
export type AvailableBridge = Prettify<
|
|
116
|
+
AvailableBridgePrice & Pick<BridgePrice, 'bridge' | 'bridgeInfo'>
|
|
117
|
+
>;
|
|
116
118
|
|
|
117
119
|
export type BridgePrice = Omit<DeltaPrice, 'bridge'> & {
|
|
118
120
|
// destAmountAfterBridge: string; // became bridgeInfo.destAmountAfterBridge
|
|
@@ -29,6 +29,10 @@ export type QuoteParams<M extends TradeMode = TradeMode> = {
|
|
|
29
29
|
userAddress?: string;
|
|
30
30
|
/** @description Partner string */
|
|
31
31
|
partner?: string;
|
|
32
|
+
/** @description Maximum price impact (in percentage) acceptable for the trade */
|
|
33
|
+
maxImpact?: number;
|
|
34
|
+
/** @description Maximum price impact (in USD) acceptable for the trade */
|
|
35
|
+
maxUSDImpact?: number;
|
|
32
36
|
/** @description Preferred mode for the trade. In case of "all", Delta pricing is returned, with Market as a fallback */
|
|
33
37
|
mode: M;
|
|
34
38
|
};
|
|
@@ -15,7 +15,7 @@ export type GetAdaptersFunctions = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
type SearchStringParams = {
|
|
18
|
-
|
|
18
|
+
chainId: number;
|
|
19
19
|
version?: APIVersion;
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -30,7 +30,7 @@ export const constructGetAdapters = ({
|
|
|
30
30
|
): Promise<AdaptersAsStrings> => {
|
|
31
31
|
// always pass explicit type to make sure UrlSearchParams are correct
|
|
32
32
|
const query = constructSearchString<SearchStringParams>({
|
|
33
|
-
|
|
33
|
+
chainId,
|
|
34
34
|
version,
|
|
35
35
|
});
|
|
36
36
|
|
|
@@ -42,9 +42,9 @@ type RateQueryParams = {
|
|
|
42
42
|
side?: 'SELL' | 'BUY';
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* @description
|
|
45
|
+
* @description Chain ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100, Unichain - 130, Sonic - 146). Default: `1`.
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
chainId?: number;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* @description If provided, **others** object is filled in the response with price quotes from other exchanges _(if available for comparison)_. Default: `false`.
|
|
@@ -221,7 +221,7 @@ export const constructGetRate = ({
|
|
|
221
221
|
const search = constructSearchString<Omit<RateQueryParams, 'route'>>({
|
|
222
222
|
srcToken,
|
|
223
223
|
destToken,
|
|
224
|
-
|
|
224
|
+
chainId,
|
|
225
225
|
version,
|
|
226
226
|
...parsedOptions,
|
|
227
227
|
});
|
|
@@ -253,7 +253,7 @@ export const constructGetRate = ({
|
|
|
253
253
|
Omit<RateQueryParams, 'srcToken' | 'destToken'>
|
|
254
254
|
>({
|
|
255
255
|
route: _route, // route can be used in place of srcToken+destToken
|
|
256
|
-
|
|
256
|
+
chainId,
|
|
257
257
|
version,
|
|
258
258
|
...parsedOptions,
|
|
259
259
|
});
|
|
@@ -36,8 +36,8 @@ export const constructGetSpender = ({
|
|
|
36
36
|
chainId,
|
|
37
37
|
fetcher,
|
|
38
38
|
}: ConstructFetchInput): GetSpenderFunctions => {
|
|
39
|
-
const search = constructSearchString<{
|
|
40
|
-
|
|
39
|
+
const search = constructSearchString<{ chainId: number; version: string }>({
|
|
40
|
+
chainId,
|
|
41
41
|
version,
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -41,9 +41,9 @@ type SwapQueryParams = {
|
|
|
41
41
|
side: 'SELL' | 'BUY';
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* @description
|
|
44
|
+
* @description Chain ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100, Unichain - 130, Sonic - 146). Default: `1`.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
chainId?: number;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* @description Comma Separated List of DEXs to include. **Supported DEXs:** Uniswap, Kyber, Bancor, AugustusRFQ, Oasis, Compound, Fulcrum, 0x, MakerDAO, Chai, Aave, Aave2, MultiPath, MegaPath, Curve, Curve3, Saddle, IronV2, BDai, idle, Weth, Beth, UniswapV2, Balancer, 0xRFQt, SushiSwap, LINKSWAP, Synthetix, DefiSwap, Swerve, CoFiX, Shell, DODOV1, DODOV2, OnChainPricing, PancakeSwap, PancakeSwapV2, ApeSwap, Wbnb, acryptos, streetswap, bakeryswap, julswap, vswap, vpegswap, beltfi, ellipsis, QuickSwap, COMETH, Wmatic, Nerve, Dfyn, UniswapV3, Smoothy, PantherSwap, OMM1, OneInchLP, CurveV2, mStable, WaultFinance, MDEX, ShibaSwap, CoinSwap, SakeSwap, JetSwap, Biswap, BProtocol eg: `UniswapV3,0x`.
|
|
@@ -179,7 +179,7 @@ type SwapTxInputListFields =
|
|
|
179
179
|
|
|
180
180
|
type SwapRateOptions = Omit<
|
|
181
181
|
SwapQueryParams,
|
|
182
|
-
SwapTxInputFields | SwapTxInputListFields | '
|
|
182
|
+
SwapTxInputFields | SwapTxInputListFields | 'chainId' | 'version'
|
|
183
183
|
> & {
|
|
184
184
|
/**
|
|
185
185
|
* @description List of DEXs to include. **Supported DEXs:** Uniswap, Kyber, Bancor, AugustusRFQ, Oasis, Compound, Fulcrum, 0x, MakerDAO, Chai, Aave, Aave2, MultiPath, MegaPath, Curve, Curve3, Saddle, IronV2, BDai, idle, Weth, Beth, UniswapV2, Balancer, 0xRFQt, SushiSwap, LINKSWAP, Synthetix, DefiSwap, Swerve, CoFiX, Shell, DODOV1, DODOV2, OnChainPricing, PancakeSwap, PancakeSwapV2, ApeSwap, Wbnb, acryptos, streetswap, bakeryswap, julswap, vswap, vpegswap, beltfi, ellipsis, QuickSwap, COMETH, Wmatic, Nerve, Dfyn, UniswapV3, Smoothy, PantherSwap, OMM1, OneInchLP, CurveV2, mStable, WaultFinance, MDEX, ShibaSwap, CoinSwap, SakeSwap, JetSwap, Biswap, BProtocol eg: `UniswapV3,0x`.
|
|
@@ -244,7 +244,7 @@ export const constructSwapTx = ({
|
|
|
244
244
|
srcToken,
|
|
245
245
|
destToken,
|
|
246
246
|
route: _route,
|
|
247
|
-
|
|
247
|
+
chainId,
|
|
248
248
|
version,
|
|
249
249
|
...parsedOptions,
|
|
250
250
|
});
|