@nightlylabs/dex-sdk 0.2.16 → 0.2.18
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.cjs +11 -8
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -309,7 +309,6 @@ var ABI10 = {
|
|
|
309
309
|
"u64",
|
|
310
310
|
"u64",
|
|
311
311
|
"bool",
|
|
312
|
-
"bool",
|
|
313
312
|
"u64"
|
|
314
313
|
],
|
|
315
314
|
"return": []
|
|
@@ -1949,13 +1948,13 @@ var Client = class _Client {
|
|
|
1949
1948
|
}, this.timeout);
|
|
1950
1949
|
let handler = (response) => {
|
|
1951
1950
|
clearTimeout(timer);
|
|
1951
|
+
this._subscriptions.delete(topic);
|
|
1952
1952
|
if (response.type === "Error") {
|
|
1953
|
-
|
|
1954
|
-
reject();
|
|
1955
|
-
|
|
1956
|
-
this._subscriptions.delete(topic);
|
|
1957
|
-
resolve(response);
|
|
1953
|
+
const errorMessage = response.content.message || "Unknown websocket error without message";
|
|
1954
|
+
reject(new Error(`WebSocket error (id: ${response.content.id}): ${errorMessage}`));
|
|
1955
|
+
return;
|
|
1958
1956
|
}
|
|
1957
|
+
resolve(response);
|
|
1959
1958
|
};
|
|
1960
1959
|
this._subscriptions.set(topic, handler);
|
|
1961
1960
|
this._ws?.send(JSON.stringify(message));
|
|
@@ -2432,7 +2431,6 @@ var Client = class _Client {
|
|
|
2432
2431
|
params.orderId,
|
|
2433
2432
|
params.newPrice,
|
|
2434
2433
|
params.newSize,
|
|
2435
|
-
params.postOnly,
|
|
2436
2434
|
params.reduceOnly,
|
|
2437
2435
|
params.triggerPrice
|
|
2438
2436
|
]
|
|
@@ -2717,6 +2715,11 @@ var Client = class _Client {
|
|
|
2717
2715
|
}
|
|
2718
2716
|
async placeMultipleSpotOrders(params) {
|
|
2719
2717
|
const markets = params.spotOrders.map((order) => order.marketName);
|
|
2718
|
+
const uniqueMarkets = new Set(markets);
|
|
2719
|
+
if (uniqueMarkets.size !== 1) {
|
|
2720
|
+
throw new Error("All spot orders must be for the same market");
|
|
2721
|
+
}
|
|
2722
|
+
const uniqueMarket = uniqueMarkets.values().next().value;
|
|
2720
2723
|
const isBids = params.spotOrders.map((order) => order.isBid);
|
|
2721
2724
|
const prices = params.spotOrders.map((order) => order.price);
|
|
2722
2725
|
const sizes = params.spotOrders.map((order) => order.size);
|
|
@@ -2731,7 +2734,7 @@ var Client = class _Client {
|
|
|
2731
2734
|
}),
|
|
2732
2735
|
function: `${placeMultipleSpotOrders_default.address}::${placeMultipleSpotOrders_default.name}::${placeMultipleSpotOrders_default.exposed_functions[0].name}`,
|
|
2733
2736
|
typeArguments: [],
|
|
2734
|
-
functionArguments: [params.userId,
|
|
2737
|
+
functionArguments: [params.userId, uniqueMarket, isBids, prices, sizes, postOnly]
|
|
2735
2738
|
});
|
|
2736
2739
|
return await this.createAndSubmitTransaction(aptosPayload);
|
|
2737
2740
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -132,14 +132,15 @@ interface CheckReferralCodeResponse {
|
|
|
132
132
|
interface ClaimReferralFee {
|
|
133
133
|
userId: string;
|
|
134
134
|
referralUsers: string[];
|
|
135
|
-
|
|
135
|
+
tokens: string[];
|
|
136
|
+
amounts: string[];
|
|
136
137
|
}
|
|
137
138
|
interface ClaimUserKickbackFee {
|
|
138
139
|
userId: string;
|
|
139
|
-
|
|
140
|
+
claimedKickback: Record<string, string>;
|
|
140
141
|
}
|
|
141
142
|
interface ClaimedKickback {
|
|
142
|
-
|
|
143
|
+
claimedKickbacks: Record<string, string>;
|
|
143
144
|
timestamp: string;
|
|
144
145
|
}
|
|
145
146
|
interface ClaimedReferralKickback {
|
|
@@ -227,7 +228,7 @@ interface FeeTier {
|
|
|
227
228
|
interface Fees {
|
|
228
229
|
tier: string;
|
|
229
230
|
slaveKickback: string;
|
|
230
|
-
userAccFee: string
|
|
231
|
+
userAccFee: Record<string, string>;
|
|
231
232
|
masterId?: string;
|
|
232
233
|
masterKickback: string;
|
|
233
234
|
}
|
|
@@ -1672,7 +1673,6 @@ interface ChangePerpOrderParams {
|
|
|
1672
1673
|
orderId: string;
|
|
1673
1674
|
newPrice: string;
|
|
1674
1675
|
newSize: string;
|
|
1675
|
-
postOnly: boolean;
|
|
1676
1676
|
reduceOnly: boolean;
|
|
1677
1677
|
triggerPrice: string;
|
|
1678
1678
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -132,14 +132,15 @@ interface CheckReferralCodeResponse {
|
|
|
132
132
|
interface ClaimReferralFee {
|
|
133
133
|
userId: string;
|
|
134
134
|
referralUsers: string[];
|
|
135
|
-
|
|
135
|
+
tokens: string[];
|
|
136
|
+
amounts: string[];
|
|
136
137
|
}
|
|
137
138
|
interface ClaimUserKickbackFee {
|
|
138
139
|
userId: string;
|
|
139
|
-
|
|
140
|
+
claimedKickback: Record<string, string>;
|
|
140
141
|
}
|
|
141
142
|
interface ClaimedKickback {
|
|
142
|
-
|
|
143
|
+
claimedKickbacks: Record<string, string>;
|
|
143
144
|
timestamp: string;
|
|
144
145
|
}
|
|
145
146
|
interface ClaimedReferralKickback {
|
|
@@ -227,7 +228,7 @@ interface FeeTier {
|
|
|
227
228
|
interface Fees {
|
|
228
229
|
tier: string;
|
|
229
230
|
slaveKickback: string;
|
|
230
|
-
userAccFee: string
|
|
231
|
+
userAccFee: Record<string, string>;
|
|
231
232
|
masterId?: string;
|
|
232
233
|
masterKickback: string;
|
|
233
234
|
}
|
|
@@ -1672,7 +1673,6 @@ interface ChangePerpOrderParams {
|
|
|
1672
1673
|
orderId: string;
|
|
1673
1674
|
newPrice: string;
|
|
1674
1675
|
newSize: string;
|
|
1675
|
-
postOnly: boolean;
|
|
1676
1676
|
reduceOnly: boolean;
|
|
1677
1677
|
triggerPrice: string;
|
|
1678
1678
|
}
|
package/dist/index.js
CHANGED
|
@@ -259,7 +259,6 @@ var ABI10 = {
|
|
|
259
259
|
"u64",
|
|
260
260
|
"u64",
|
|
261
261
|
"bool",
|
|
262
|
-
"bool",
|
|
263
262
|
"u64"
|
|
264
263
|
],
|
|
265
264
|
"return": []
|
|
@@ -1899,13 +1898,13 @@ var Client = class _Client {
|
|
|
1899
1898
|
}, this.timeout);
|
|
1900
1899
|
let handler = (response) => {
|
|
1901
1900
|
clearTimeout(timer);
|
|
1901
|
+
this._subscriptions.delete(topic);
|
|
1902
1902
|
if (response.type === "Error") {
|
|
1903
|
-
|
|
1904
|
-
reject();
|
|
1905
|
-
|
|
1906
|
-
this._subscriptions.delete(topic);
|
|
1907
|
-
resolve(response);
|
|
1903
|
+
const errorMessage = response.content.message || "Unknown websocket error without message";
|
|
1904
|
+
reject(new Error(`WebSocket error (id: ${response.content.id}): ${errorMessage}`));
|
|
1905
|
+
return;
|
|
1908
1906
|
}
|
|
1907
|
+
resolve(response);
|
|
1909
1908
|
};
|
|
1910
1909
|
this._subscriptions.set(topic, handler);
|
|
1911
1910
|
this._ws?.send(JSON.stringify(message));
|
|
@@ -2382,7 +2381,6 @@ var Client = class _Client {
|
|
|
2382
2381
|
params.orderId,
|
|
2383
2382
|
params.newPrice,
|
|
2384
2383
|
params.newSize,
|
|
2385
|
-
params.postOnly,
|
|
2386
2384
|
params.reduceOnly,
|
|
2387
2385
|
params.triggerPrice
|
|
2388
2386
|
]
|
|
@@ -2667,6 +2665,11 @@ var Client = class _Client {
|
|
|
2667
2665
|
}
|
|
2668
2666
|
async placeMultipleSpotOrders(params) {
|
|
2669
2667
|
const markets = params.spotOrders.map((order) => order.marketName);
|
|
2668
|
+
const uniqueMarkets = new Set(markets);
|
|
2669
|
+
if (uniqueMarkets.size !== 1) {
|
|
2670
|
+
throw new Error("All spot orders must be for the same market");
|
|
2671
|
+
}
|
|
2672
|
+
const uniqueMarket = uniqueMarkets.values().next().value;
|
|
2670
2673
|
const isBids = params.spotOrders.map((order) => order.isBid);
|
|
2671
2674
|
const prices = params.spotOrders.map((order) => order.price);
|
|
2672
2675
|
const sizes = params.spotOrders.map((order) => order.size);
|
|
@@ -2681,7 +2684,7 @@ var Client = class _Client {
|
|
|
2681
2684
|
}),
|
|
2682
2685
|
function: `${placeMultipleSpotOrders_default.address}::${placeMultipleSpotOrders_default.name}::${placeMultipleSpotOrders_default.exposed_functions[0].name}`,
|
|
2683
2686
|
typeArguments: [],
|
|
2684
|
-
functionArguments: [params.userId,
|
|
2687
|
+
functionArguments: [params.userId, uniqueMarket, isBids, prices, sizes, postOnly]
|
|
2685
2688
|
});
|
|
2686
2689
|
return await this.createAndSubmitTransaction(aptosPayload);
|
|
2687
2690
|
}
|