@velora-dex/sdk 8.0.0 → 8.1.0
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/README.md +73 -11
- package/dist/examples/helpers/delta.d.ts +5 -0
- package/dist/examples/helpers/delta.d.ts.map +1 -0
- package/dist/helpers/misc.d.ts +4 -0
- package/dist/helpers/misc.d.ts.map +1 -1
- package/dist/methods/delta/buildCrosschainOrderBridge.d.ts +1 -1
- package/dist/methods/delta/buildCrosschainOrderBridge.d.ts.map +1 -1
- package/dist/methods/delta/buildDeltaOrder.d.ts +1 -1
- package/dist/methods/delta/buildDeltaOrder.d.ts.map +1 -1
- package/dist/methods/delta/getDeltaPrice.d.ts +2 -0
- package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -1
- package/dist/methods/delta/helpers/across.d.ts +3 -6
- package/dist/methods/delta/helpers/across.d.ts.map +1 -1
- package/dist/methods/quote/getQuote.d.ts +25 -4
- package/dist/methods/quote/getQuote.d.ts.map +1 -1
- package/dist/sdk.cjs.development.js +67 -143
- 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 +67 -143
- package/dist/sdk.esm.js.map +1 -1
- package/docs/DELTA.md +69 -7
- package/package.json +1 -1
- package/src/examples/delta.ts +5 -10
- package/src/examples/helpers/delta.ts +39 -0
- package/src/examples/quote.ts +6 -8
- package/src/examples/simpleQuote.ts +3 -5
- package/src/helpers/misc.ts +8 -0
- package/src/methods/delta/buildCrosschainOrderBridge.ts +12 -9
- package/src/methods/delta/buildDeltaOrder.ts +20 -18
- package/src/methods/delta/getDeltaPrice.ts +2 -0
- package/src/methods/delta/helpers/across.ts +25 -91
- package/src/methods/quote/getQuote.ts +59 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { API_URL, SwapSide } from '../../constants';
|
|
2
2
|
import { constructSearchString } from '../../helpers/misc';
|
|
3
|
-
import type { DeltaPrice } from '../delta/getDeltaPrice';
|
|
3
|
+
import type { BridgePrice, DeltaPrice } from '../delta/getDeltaPrice';
|
|
4
4
|
import type {
|
|
5
5
|
ConstructFetchInput,
|
|
6
6
|
EnumerateLiteral,
|
|
@@ -48,6 +48,17 @@ export type QuoteWithMarketPrice = {
|
|
|
48
48
|
|
|
49
49
|
export type QuoteWithDeltaPrice = {
|
|
50
50
|
delta: DeltaPrice;
|
|
51
|
+
deltaAddress: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type QuoteWithBridgePrice = {
|
|
55
|
+
delta: BridgePrice;
|
|
56
|
+
deltaAddress: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type QuoteWithDeltaPriceAndBridgePrice = {
|
|
60
|
+
delta: DeltaPrice | BridgePrice;
|
|
61
|
+
deltaAddress: string;
|
|
51
62
|
};
|
|
52
63
|
|
|
53
64
|
export type QuoteWithMarketPriceAsFallback = QuoteWithMarketPrice & {
|
|
@@ -57,20 +68,41 @@ export type QuoteWithMarketPriceAsFallback = QuoteWithMarketPrice & {
|
|
|
57
68
|
export type QuoteResponse =
|
|
58
69
|
| QuoteWithDeltaPrice
|
|
59
70
|
| QuoteWithMarketPrice
|
|
71
|
+
| QuoteWithBridgePrice
|
|
60
72
|
| QuoteWithMarketPriceAsFallback;
|
|
61
73
|
|
|
62
74
|
interface GetQuoteFunc {
|
|
63
75
|
(
|
|
64
|
-
options: QuoteParams<'delta'
|
|
76
|
+
options: QuoteParams<'delta'> & { destChainId?: undefined },
|
|
65
77
|
requestParams?: RequestParameters
|
|
66
78
|
): Promise<QuoteWithDeltaPrice>;
|
|
79
|
+
(
|
|
80
|
+
options: QuoteParams<'delta'> & { destChainId: number },
|
|
81
|
+
requestParams?: RequestParameters
|
|
82
|
+
): Promise<QuoteWithBridgePrice>;
|
|
83
|
+
(
|
|
84
|
+
options: QuoteParams<'delta'>,
|
|
85
|
+
requestParams?: RequestParameters
|
|
86
|
+
): Promise<QuoteWithDeltaPriceAndBridgePrice>;
|
|
67
87
|
(
|
|
68
88
|
options: QuoteParams<'market'>,
|
|
69
89
|
requestParams?: RequestParameters
|
|
70
90
|
): Promise<QuoteWithMarketPrice>;
|
|
71
|
-
(
|
|
91
|
+
(
|
|
92
|
+
options: QuoteParams<'all'> & { destChainId?: undefined },
|
|
93
|
+
requestParams?: RequestParameters
|
|
94
|
+
): Promise<
|
|
72
95
|
QuoteWithDeltaPrice | QuoteWithMarketPriceAsFallback // "all" mode tries for deltaPrice and falls back to market priceRoute
|
|
73
96
|
>;
|
|
97
|
+
(
|
|
98
|
+
options: QuoteParams<'all'> & { destChainId: number },
|
|
99
|
+
requestParams?: RequestParameters
|
|
100
|
+
): Promise<
|
|
101
|
+
QuoteWithBridgePrice | QuoteWithMarketPriceAsFallback // "all" mode tries for deltaPrice and falls back to market priceRoute
|
|
102
|
+
>;
|
|
103
|
+
(options: QuoteParams<'all'>, requestParams?: RequestParameters): Promise<
|
|
104
|
+
QuoteWithDeltaPriceAndBridgePrice | QuoteWithMarketPriceAsFallback // "all" mode tries for deltaPrice and falls back to market priceRoute
|
|
105
|
+
>;
|
|
74
106
|
(
|
|
75
107
|
options: QuoteParams,
|
|
76
108
|
requestParams?: RequestParameters
|
|
@@ -89,17 +121,39 @@ export const constructGetQuote = ({
|
|
|
89
121
|
const pricesUrl = `${apiURL}/quote` as const;
|
|
90
122
|
|
|
91
123
|
function getQuote(
|
|
92
|
-
options: QuoteParams<'delta'
|
|
124
|
+
options: QuoteParams<'delta'> & { destChainId?: undefined },
|
|
93
125
|
requestParams?: RequestParameters
|
|
94
126
|
): Promise<QuoteWithDeltaPrice>;
|
|
127
|
+
function getQuote(
|
|
128
|
+
options: QuoteParams<'delta'> & { destChainId: number },
|
|
129
|
+
requestParams?: RequestParameters
|
|
130
|
+
): Promise<QuoteWithBridgePrice>;
|
|
131
|
+
function getQuote(
|
|
132
|
+
options: QuoteParams<'delta'>,
|
|
133
|
+
requestParams?: RequestParameters
|
|
134
|
+
): Promise<QuoteWithDeltaPriceAndBridgePrice>;
|
|
95
135
|
function getQuote(
|
|
96
136
|
options: QuoteParams<'market'>,
|
|
97
137
|
requestParams?: RequestParameters
|
|
98
138
|
): Promise<QuoteWithMarketPrice>;
|
|
139
|
+
function getQuote(
|
|
140
|
+
options: QuoteParams<'all'> & { destChainId?: undefined },
|
|
141
|
+
requestParams?: RequestParameters
|
|
142
|
+
): Promise<
|
|
143
|
+
QuoteWithDeltaPrice | QuoteWithMarketPriceAsFallback // "all" mode tries for deltaPrice and falls back to market priceRoute
|
|
144
|
+
>;
|
|
145
|
+
function getQuote(
|
|
146
|
+
options: QuoteParams<'all'> & { destChainId: number },
|
|
147
|
+
requestParams?: RequestParameters
|
|
148
|
+
): Promise<
|
|
149
|
+
QuoteWithBridgePrice | QuoteWithMarketPriceAsFallback // "all" mode tries for deltaPrice and falls back to market priceRoute
|
|
150
|
+
>;
|
|
99
151
|
function getQuote(
|
|
100
152
|
options: QuoteParams<'all'>,
|
|
101
153
|
requestParams?: RequestParameters
|
|
102
|
-
): Promise<
|
|
154
|
+
): Promise<
|
|
155
|
+
QuoteWithDeltaPriceAndBridgePrice | QuoteWithMarketPriceAsFallback
|
|
156
|
+
>;
|
|
103
157
|
function getQuote(
|
|
104
158
|
options: QuoteParams,
|
|
105
159
|
requestParams?: RequestParameters
|