@velora-dex/sdk 9.3.0-dev.0 → 9.3.0-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/dist/methods/delta/getBridgeInfo.d.ts +13 -1
- package/dist/methods/delta/getBridgeInfo.d.ts.map +1 -1
- package/dist/methods/delta/getDeltaOrders.d.ts +1 -1
- package/dist/methods/delta/getDeltaOrders.d.ts.map +1 -1
- package/dist/methods/delta/getDeltaPrice.d.ts +1 -1
- package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -1
- package/dist/methods/delta/helpers/types.d.ts +1 -3
- package/dist/methods/delta/helpers/types.d.ts.map +1 -1
- package/dist/methods/delta/postDeltaOrder.d.ts +0 -1
- package/dist/methods/delta/postDeltaOrder.d.ts.map +1 -1
- package/dist/sdk.cjs.development.js +47 -9
- 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 +47 -9
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/methods/delta/getBridgeInfo.ts +58 -4
- package/src/methods/delta/getDeltaOrders.ts +1 -1
- package/src/methods/delta/getDeltaPrice.ts +3 -3
- package/src/methods/delta/helpers/types.ts +1 -16
- package/src/methods/delta/postDeltaOrder.ts +0 -1
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { API_URL } from '../../constants';
|
|
2
|
+
import { constructSearchString } from '../../helpers/misc';
|
|
2
3
|
import type {
|
|
3
4
|
Address,
|
|
4
5
|
ConstructFetchInput,
|
|
@@ -10,21 +11,61 @@ import type {
|
|
|
10
11
|
export type BridgeInfo = Record<number, Record<number, Address[]>>;
|
|
11
12
|
type BridgeInfoResponse = { supportedTokens: BridgeInfo };
|
|
12
13
|
|
|
13
|
-
type
|
|
14
|
+
type GetBridgeInfoParams = {
|
|
15
|
+
/** @description Include tokens that can be swapped on destChain after bridge. Default is true. */
|
|
16
|
+
allowBridgeAndSwap?: boolean;
|
|
17
|
+
/** @description Include only the specified bridges. Default is all bridges. */
|
|
18
|
+
bridges?: string[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type BridgeInfoQuery = {
|
|
22
|
+
allowBridgeAndSwap?: string;
|
|
23
|
+
bridges?: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type GetBridgeInfo = (
|
|
27
|
+
params?: GetBridgeInfoParams,
|
|
28
|
+
requestParams?: RequestParameters
|
|
29
|
+
) => Promise<BridgeInfo>;
|
|
30
|
+
|
|
31
|
+
type BridgeProtocolResponse = {
|
|
32
|
+
protocol: string;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type BridgeProtocolsResponse = {
|
|
37
|
+
bridgeProtocols: BridgeProtocolResponse[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type GetBridgeProtocols = (
|
|
41
|
+
requestParams?: RequestParameters
|
|
42
|
+
) => Promise<BridgeProtocolResponse[]>;
|
|
14
43
|
|
|
15
44
|
export type GetBridgeInfoFunctions = {
|
|
16
45
|
getBridgeInfo: GetBridgeInfo;
|
|
46
|
+
getBridgeProtocols: GetBridgeProtocols;
|
|
17
47
|
};
|
|
18
48
|
|
|
19
49
|
export const constructGetBridgeInfo = ({
|
|
20
50
|
apiURL = API_URL,
|
|
21
51
|
fetcher,
|
|
22
52
|
}: ConstructFetchInput): GetBridgeInfoFunctions => {
|
|
23
|
-
const
|
|
53
|
+
const deltaBridgeUrl = `${apiURL}/delta/prices` as const;
|
|
54
|
+
|
|
55
|
+
const getBridgeInfo: GetBridgeInfo = async (params = {}, requestParams) => {
|
|
56
|
+
const { allowBridgeAndSwap, bridges } = params;
|
|
57
|
+
const allowBridgeAndSwapString = allowBridgeAndSwap ? 'true' : 'false';
|
|
58
|
+
const bridgesString = bridges ? bridges.join(',') : undefined;
|
|
59
|
+
|
|
60
|
+
const search = constructSearchString<BridgeInfoQuery>({
|
|
61
|
+
allowBridgeAndSwap: allowBridgeAndSwapString,
|
|
62
|
+
bridges: bridgesString,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const fetchURL = `${deltaBridgeUrl}/bridge-info${search}` as const;
|
|
24
66
|
|
|
25
|
-
const getBridgeInfo: GetBridgeInfo = async (requestParams) => {
|
|
26
67
|
const data = await fetcher<BridgeInfoResponse>({
|
|
27
|
-
url:
|
|
68
|
+
url: fetchURL,
|
|
28
69
|
method: 'GET',
|
|
29
70
|
requestParams,
|
|
30
71
|
});
|
|
@@ -32,7 +73,20 @@ export const constructGetBridgeInfo = ({
|
|
|
32
73
|
return data.supportedTokens;
|
|
33
74
|
};
|
|
34
75
|
|
|
76
|
+
const getBridgeProtocols: GetBridgeProtocols = async (requestParams) => {
|
|
77
|
+
const fetchURL = `${deltaBridgeUrl}/bridge-protocols` as const;
|
|
78
|
+
|
|
79
|
+
const data = await fetcher<BridgeProtocolsResponse>({
|
|
80
|
+
url: fetchURL,
|
|
81
|
+
method: 'GET',
|
|
82
|
+
requestParams,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return data.bridgeProtocols;
|
|
86
|
+
};
|
|
87
|
+
|
|
35
88
|
return {
|
|
36
89
|
getBridgeInfo,
|
|
90
|
+
getBridgeProtocols,
|
|
37
91
|
};
|
|
38
92
|
};
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from '../../types';
|
|
8
8
|
import type { DeltaAuction, DeltaAuctionStatus } from './helpers/types';
|
|
9
9
|
|
|
10
|
-
export type DeltaOrderFromAPI = Omit<DeltaAuction, 'signature'
|
|
10
|
+
export type DeltaOrderFromAPI = Omit<DeltaAuction, 'signature'>;
|
|
11
11
|
|
|
12
12
|
export type DeltaOrderFilterByStatus =
|
|
13
13
|
| DeltaAuctionStatus
|
|
@@ -39,7 +39,7 @@ export type DeltaPriceParams = {
|
|
|
39
39
|
excludeBridges?: string[];
|
|
40
40
|
|
|
41
41
|
/** @description Allow swap on destChain after bridge. Default is true. */
|
|
42
|
-
|
|
42
|
+
allowBridgeAndSwap?: boolean;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
type DeltaPriceQueryOptions = Omit<
|
|
@@ -98,9 +98,9 @@ type AvailableBridgePrice = Pick<
|
|
|
98
98
|
DeltaPrice,
|
|
99
99
|
| 'destToken'
|
|
100
100
|
| 'destAmount'
|
|
101
|
-
| 'destAmountBeforeFee'
|
|
101
|
+
| 'destAmountBeforeFee' // Available for SELL side
|
|
102
102
|
| 'destUSD'
|
|
103
|
-
| 'destUSDBeforeFee'
|
|
103
|
+
| 'destUSDBeforeFee' // Available for SELL side
|
|
104
104
|
| 'gasCostUSD'
|
|
105
105
|
| 'gasCost'
|
|
106
106
|
| 'gasCostUSDBeforeFee'
|
|
@@ -95,7 +95,6 @@ export type DeltaAuction = {
|
|
|
95
95
|
deltaVersion: string; // 1.0 or 2.0 currently
|
|
96
96
|
user: string;
|
|
97
97
|
signature: string;
|
|
98
|
-
cosignature: string; // added for Crosschain Orders after bridge
|
|
99
98
|
status: DeltaAuctionStatus;
|
|
100
99
|
order: DeltaAuctionOrder;
|
|
101
100
|
orderHash: string | null; // not available on old Orders only
|
|
@@ -139,20 +138,6 @@ export type BridgeStatus = 'pending' | 'filled' | 'expired' | 'refunded';
|
|
|
139
138
|
|
|
140
139
|
//// available on BridgePrice ////
|
|
141
140
|
|
|
142
|
-
// so far
|
|
143
|
-
type ProtocolName =
|
|
144
|
-
| 'Across'
|
|
145
|
-
| 'StargateBus'
|
|
146
|
-
| 'StargateTaxi'
|
|
147
|
-
| 'StargateOftV2'
|
|
148
|
-
| 'Relay'
|
|
149
|
-
| 'CCTPFast'
|
|
150
|
-
| 'CCTPStandard'
|
|
151
|
-
| 'Celer'
|
|
152
|
-
| 'Canonical'
|
|
153
|
-
| 'Polygon'
|
|
154
|
-
| 'Arbitrum';
|
|
155
|
-
|
|
156
141
|
type BridgeQuoteFee = {
|
|
157
142
|
feeToken: string;
|
|
158
143
|
amount: string;
|
|
@@ -161,7 +146,7 @@ type BridgeQuoteFee = {
|
|
|
161
146
|
};
|
|
162
147
|
|
|
163
148
|
export type BridgePriceInfo = {
|
|
164
|
-
protocolName:
|
|
149
|
+
protocolName: string;
|
|
165
150
|
destAmountAfterBridge: string;
|
|
166
151
|
destUSDAfterBridge: string;
|
|
167
152
|
fees: BridgeQuoteFee[];
|