@rhea-finance/cross-chain-aggregation-dex 2.1.3 → 2.1.5
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 +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -47,31 +47,35 @@ function resolveSwapReportRecordId(reportData) {
|
|
|
47
47
|
}
|
|
48
48
|
function buildOrderStatusQuery(params) {
|
|
49
49
|
const reportId = String(params.recordId ?? "").trim();
|
|
50
|
-
|
|
50
|
+
if (reportId) {
|
|
51
|
+
const query2 = { recordId: reportId };
|
|
52
|
+
const router2 = params.router?.trim();
|
|
53
|
+
if (router2) query2.router = router2;
|
|
54
|
+
return query2;
|
|
55
|
+
}
|
|
56
|
+
const orderId = params.orderId?.trim();
|
|
51
57
|
if (!orderId) return {};
|
|
52
58
|
const query = { orderId };
|
|
53
59
|
const router = params.router?.trim();
|
|
54
60
|
if (router) query.router = router;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
query.chainId = chainId;
|
|
59
|
-
}
|
|
61
|
+
const chainId = params.chainId;
|
|
62
|
+
if (chainId !== void 0 && chainId !== null && String(chainId).trim() !== "") {
|
|
63
|
+
query.chainId = chainId;
|
|
60
64
|
}
|
|
61
65
|
return query;
|
|
62
66
|
}
|
|
63
67
|
function resolveOrderStatusLookup(input) {
|
|
64
68
|
const reportId = String(input.recordId ?? "").trim();
|
|
65
|
-
const orderId = reportId || input.orderId?.trim();
|
|
66
|
-
if (!orderId) return void 0;
|
|
67
69
|
const router = input.router?.trim();
|
|
68
|
-
const chainId = reportId ? void 0 : input.chainId !== void 0 && input.chainId !== null && String(input.chainId).trim() !== "" ? String(input.chainId).trim() : void 0;
|
|
69
70
|
if (reportId) {
|
|
70
71
|
return {
|
|
71
|
-
|
|
72
|
+
recordId: reportId,
|
|
72
73
|
...router ? { router } : {}
|
|
73
74
|
};
|
|
74
75
|
}
|
|
76
|
+
const orderId = input.orderId?.trim();
|
|
77
|
+
if (!orderId) return void 0;
|
|
78
|
+
const chainId = input.chainId !== void 0 && input.chainId !== null && String(input.chainId).trim() !== "" ? String(input.chainId).trim() : void 0;
|
|
75
79
|
return {
|
|
76
80
|
orderId,
|
|
77
81
|
...router ? { router } : {},
|
|
@@ -84,7 +88,7 @@ function assertOrderStatusParams(params) {
|
|
|
84
88
|
throw new SwapSdkError(
|
|
85
89
|
"INVALID_REQUEST",
|
|
86
90
|
"status",
|
|
87
|
-
"Order status requires orderId"
|
|
91
|
+
"Order status requires recordId or orderId"
|
|
88
92
|
);
|
|
89
93
|
}
|
|
90
94
|
return lookup;
|
|
@@ -93,7 +97,7 @@ function orderStatusParamsFromHistoryItem(item) {
|
|
|
93
97
|
const reportId = String(item.id ?? "").trim();
|
|
94
98
|
if (reportId) {
|
|
95
99
|
return {
|
|
96
|
-
|
|
100
|
+
recordId: reportId,
|
|
97
101
|
...item.router ? { router: item.router } : {}
|
|
98
102
|
};
|
|
99
103
|
}
|
|
@@ -154,11 +158,11 @@ var ApiClient = class {
|
|
|
154
158
|
}
|
|
155
159
|
getOrderStatus(params, options = {}) {
|
|
156
160
|
const query = buildOrderStatusQuery(params);
|
|
157
|
-
if (!query.orderId) {
|
|
161
|
+
if (!query.recordId && !query.orderId) {
|
|
158
162
|
throw new SwapSdkError(
|
|
159
163
|
"INVALID_REQUEST",
|
|
160
164
|
"status",
|
|
161
|
-
"Order status requires orderId"
|
|
165
|
+
"Order status requires recordId or orderId"
|
|
162
166
|
);
|
|
163
167
|
}
|
|
164
168
|
return this.request("/api/swap/order-status", "status", {
|