pmxtjs 2.50.12 → 2.50.13
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/esm/pmxt/client.d.ts +5 -0
- package/dist/esm/pmxt/client.js +48 -0
- package/dist/pmxt/client.d.ts +5 -0
- package/dist/pmxt/client.js +48 -0
- package/generated/package.json +1 -1
- package/package.json +2 -2
- package/pmxt/client.ts +53 -0
|
@@ -449,6 +449,11 @@ export declare abstract class Exchange {
|
|
|
449
449
|
* pull-leg route name for Opinion sells and Limitless cross-chain orders.
|
|
450
450
|
*/
|
|
451
451
|
private _hostedTypedDataRoute;
|
|
452
|
+
/**
|
|
453
|
+
* Hosted-mode cancelOrder: build → sign → cancel single-call wrapper.
|
|
454
|
+
* Mirrors the Python SDK's `_hosted_cancel_order`.
|
|
455
|
+
*/
|
|
456
|
+
private _hostedCancelOrder;
|
|
452
457
|
private _hostedCancelTypedDataRoute;
|
|
453
458
|
/**
|
|
454
459
|
* Construct the hosted build-order request body and validate inputs
|
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -952,6 +952,9 @@ export class Exchange {
|
|
|
952
952
|
}
|
|
953
953
|
async cancelOrder(orderId) {
|
|
954
954
|
await this.initPromise;
|
|
955
|
+
if (this.isHosted) {
|
|
956
|
+
return this._hostedCancelOrder(orderId);
|
|
957
|
+
}
|
|
955
958
|
try {
|
|
956
959
|
const args = [];
|
|
957
960
|
args.push(orderId);
|
|
@@ -2110,6 +2113,51 @@ export class Exchange {
|
|
|
2110
2113
|
return "opinion_buy";
|
|
2111
2114
|
return isPull ? "opinion_sell_bsc_pull" : "opinion_sell_polygon";
|
|
2112
2115
|
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Hosted-mode cancelOrder: build → sign → cancel single-call wrapper.
|
|
2118
|
+
* Mirrors the Python SDK's `_hosted_cancel_order`.
|
|
2119
|
+
*/
|
|
2120
|
+
async _hostedCancelOrder(orderId) {
|
|
2121
|
+
const signer = this.requireHostedSigner();
|
|
2122
|
+
if (!this.walletAddress) {
|
|
2123
|
+
throw new MissingWalletAddress("hosted cancelOrder requires walletAddress");
|
|
2124
|
+
}
|
|
2125
|
+
const buildRequest = { order_id: orderId, user_address: this.walletAddress };
|
|
2126
|
+
const buildRoute = HOSTED_METHOD_ROUTES.get("cancelOrderBuild");
|
|
2127
|
+
const buildPayload = await _tradingRequest(this, {
|
|
2128
|
+
method: buildRoute.method,
|
|
2129
|
+
path: buildRoute.path,
|
|
2130
|
+
body: buildRequest,
|
|
2131
|
+
});
|
|
2132
|
+
const typedData = buildPayload["typed_data"];
|
|
2133
|
+
if (!typedData) {
|
|
2134
|
+
throw new HostedInvalidSignature(0, "typed_data missing from hosted cancel build response");
|
|
2135
|
+
}
|
|
2136
|
+
const primaryRoute = this._hostedCancelTypedDataRoute(false);
|
|
2137
|
+
validateTypedData(typedData, primaryRoute, this.walletAddress);
|
|
2138
|
+
const signature = await signer.signTypedData(typedData);
|
|
2139
|
+
verifySignature(typedData, signature, signer.address);
|
|
2140
|
+
const cancelId = buildPayload["cancel_id"];
|
|
2141
|
+
if (!cancelId) {
|
|
2142
|
+
throw new HostedInvalidSignature(0, "cancel_id missing from hosted cancel build response");
|
|
2143
|
+
}
|
|
2144
|
+
const body = { cancel_id: cancelId, signature };
|
|
2145
|
+
const pullTypedData = buildPayload["pull_typed_data"];
|
|
2146
|
+
if (pullTypedData) {
|
|
2147
|
+
const pullRoute = this._hostedCancelTypedDataRoute(true);
|
|
2148
|
+
validateTypedData(pullTypedData, pullRoute, this.walletAddress);
|
|
2149
|
+
const pullSig = await signer.signTypedData(pullTypedData);
|
|
2150
|
+
verifySignature(pullTypedData, pullSig, signer.address);
|
|
2151
|
+
body["pull_signature"] = pullSig;
|
|
2152
|
+
}
|
|
2153
|
+
const cancelRoute = HOSTED_METHOD_ROUTES.get("cancelOrder");
|
|
2154
|
+
const data = await _tradingRequest(this, {
|
|
2155
|
+
method: cancelRoute.method,
|
|
2156
|
+
path: cancelRoute.path,
|
|
2157
|
+
body,
|
|
2158
|
+
});
|
|
2159
|
+
return orderFromV0(data);
|
|
2160
|
+
}
|
|
2113
2161
|
_hostedCancelTypedDataRoute(isPull) {
|
|
2114
2162
|
const venue = this.exchangeName;
|
|
2115
2163
|
if (venue === "polymarket")
|
package/dist/pmxt/client.d.ts
CHANGED
|
@@ -449,6 +449,11 @@ export declare abstract class Exchange {
|
|
|
449
449
|
* pull-leg route name for Opinion sells and Limitless cross-chain orders.
|
|
450
450
|
*/
|
|
451
451
|
private _hostedTypedDataRoute;
|
|
452
|
+
/**
|
|
453
|
+
* Hosted-mode cancelOrder: build → sign → cancel single-call wrapper.
|
|
454
|
+
* Mirrors the Python SDK's `_hosted_cancel_order`.
|
|
455
|
+
*/
|
|
456
|
+
private _hostedCancelOrder;
|
|
452
457
|
private _hostedCancelTypedDataRoute;
|
|
453
458
|
/**
|
|
454
459
|
* Construct the hosted build-order request body and validate inputs
|
package/dist/pmxt/client.js
CHANGED
|
@@ -955,6 +955,9 @@ class Exchange {
|
|
|
955
955
|
}
|
|
956
956
|
async cancelOrder(orderId) {
|
|
957
957
|
await this.initPromise;
|
|
958
|
+
if (this.isHosted) {
|
|
959
|
+
return this._hostedCancelOrder(orderId);
|
|
960
|
+
}
|
|
958
961
|
try {
|
|
959
962
|
const args = [];
|
|
960
963
|
args.push(orderId);
|
|
@@ -2113,6 +2116,51 @@ class Exchange {
|
|
|
2113
2116
|
return "opinion_buy";
|
|
2114
2117
|
return isPull ? "opinion_sell_bsc_pull" : "opinion_sell_polygon";
|
|
2115
2118
|
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Hosted-mode cancelOrder: build → sign → cancel single-call wrapper.
|
|
2121
|
+
* Mirrors the Python SDK's `_hosted_cancel_order`.
|
|
2122
|
+
*/
|
|
2123
|
+
async _hostedCancelOrder(orderId) {
|
|
2124
|
+
const signer = this.requireHostedSigner();
|
|
2125
|
+
if (!this.walletAddress) {
|
|
2126
|
+
throw new hosted_errors_js_1.MissingWalletAddress("hosted cancelOrder requires walletAddress");
|
|
2127
|
+
}
|
|
2128
|
+
const buildRequest = { order_id: orderId, user_address: this.walletAddress };
|
|
2129
|
+
const buildRoute = hosted_routing_js_1.HOSTED_METHOD_ROUTES.get("cancelOrderBuild");
|
|
2130
|
+
const buildPayload = await (0, hosted_routing_js_1._tradingRequest)(this, {
|
|
2131
|
+
method: buildRoute.method,
|
|
2132
|
+
path: buildRoute.path,
|
|
2133
|
+
body: buildRequest,
|
|
2134
|
+
});
|
|
2135
|
+
const typedData = buildPayload["typed_data"];
|
|
2136
|
+
if (!typedData) {
|
|
2137
|
+
throw new hosted_errors_js_1.InvalidSignature(0, "typed_data missing from hosted cancel build response");
|
|
2138
|
+
}
|
|
2139
|
+
const primaryRoute = this._hostedCancelTypedDataRoute(false);
|
|
2140
|
+
(0, hosted_typed_data_js_1.validateTypedData)(typedData, primaryRoute, this.walletAddress);
|
|
2141
|
+
const signature = await signer.signTypedData(typedData);
|
|
2142
|
+
(0, hosted_typed_data_js_1.verifySignature)(typedData, signature, signer.address);
|
|
2143
|
+
const cancelId = buildPayload["cancel_id"];
|
|
2144
|
+
if (!cancelId) {
|
|
2145
|
+
throw new hosted_errors_js_1.InvalidSignature(0, "cancel_id missing from hosted cancel build response");
|
|
2146
|
+
}
|
|
2147
|
+
const body = { cancel_id: cancelId, signature };
|
|
2148
|
+
const pullTypedData = buildPayload["pull_typed_data"];
|
|
2149
|
+
if (pullTypedData) {
|
|
2150
|
+
const pullRoute = this._hostedCancelTypedDataRoute(true);
|
|
2151
|
+
(0, hosted_typed_data_js_1.validateTypedData)(pullTypedData, pullRoute, this.walletAddress);
|
|
2152
|
+
const pullSig = await signer.signTypedData(pullTypedData);
|
|
2153
|
+
(0, hosted_typed_data_js_1.verifySignature)(pullTypedData, pullSig, signer.address);
|
|
2154
|
+
body["pull_signature"] = pullSig;
|
|
2155
|
+
}
|
|
2156
|
+
const cancelRoute = hosted_routing_js_1.HOSTED_METHOD_ROUTES.get("cancelOrder");
|
|
2157
|
+
const data = await (0, hosted_routing_js_1._tradingRequest)(this, {
|
|
2158
|
+
method: cancelRoute.method,
|
|
2159
|
+
path: cancelRoute.path,
|
|
2160
|
+
body,
|
|
2161
|
+
});
|
|
2162
|
+
return (0, hosted_mappers_js_1.orderFromV0)(data);
|
|
2163
|
+
}
|
|
2116
2164
|
_hostedCancelTypedDataRoute(isPull) {
|
|
2117
2165
|
const venue = this.exchangeName;
|
|
2118
2166
|
if (venue === "polymarket")
|
package/generated/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.50.
|
|
3
|
+
"version": "2.50.13",
|
|
4
4
|
"description": "Unified prediction market data API - The ccxt for prediction markets",
|
|
5
5
|
"author": "PMXT Contributors",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"unified"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"pmxt-core": "2.50.
|
|
46
|
+
"pmxt-core": "2.50.13",
|
|
47
47
|
"ws": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
package/pmxt/client.ts
CHANGED
|
@@ -1162,6 +1162,9 @@ export abstract class Exchange {
|
|
|
1162
1162
|
|
|
1163
1163
|
async cancelOrder(orderId: string): Promise<Order> {
|
|
1164
1164
|
await this.initPromise;
|
|
1165
|
+
if (this.isHosted) {
|
|
1166
|
+
return this._hostedCancelOrder(orderId);
|
|
1167
|
+
}
|
|
1165
1168
|
try {
|
|
1166
1169
|
const args: any[] = [];
|
|
1167
1170
|
args.push(orderId);
|
|
@@ -2341,6 +2344,56 @@ export abstract class Exchange {
|
|
|
2341
2344
|
return isPull ? "opinion_sell_bsc_pull" : "opinion_sell_polygon";
|
|
2342
2345
|
}
|
|
2343
2346
|
|
|
2347
|
+
/**
|
|
2348
|
+
* Hosted-mode cancelOrder: build → sign → cancel single-call wrapper.
|
|
2349
|
+
* Mirrors the Python SDK's `_hosted_cancel_order`.
|
|
2350
|
+
*/
|
|
2351
|
+
private async _hostedCancelOrder(orderId: string): Promise<Order> {
|
|
2352
|
+
const signer = this.requireHostedSigner();
|
|
2353
|
+
if (!this.walletAddress) {
|
|
2354
|
+
throw new MissingWalletAddress("hosted cancelOrder requires walletAddress");
|
|
2355
|
+
}
|
|
2356
|
+
const buildRequest = { order_id: orderId, user_address: this.walletAddress };
|
|
2357
|
+
const buildRoute = HOSTED_METHOD_ROUTES.get("cancelOrderBuild")!;
|
|
2358
|
+
const buildPayload = await _tradingRequest(this, {
|
|
2359
|
+
method: buildRoute.method,
|
|
2360
|
+
path: buildRoute.path,
|
|
2361
|
+
body: buildRequest,
|
|
2362
|
+
}) as Record<string, unknown>;
|
|
2363
|
+
|
|
2364
|
+
const typedData = buildPayload["typed_data"] as TypedData | undefined;
|
|
2365
|
+
if (!typedData) {
|
|
2366
|
+
throw new HostedInvalidSignature(0, "typed_data missing from hosted cancel build response");
|
|
2367
|
+
}
|
|
2368
|
+
const primaryRoute = this._hostedCancelTypedDataRoute(false);
|
|
2369
|
+
validateTypedData(typedData, primaryRoute, this.walletAddress);
|
|
2370
|
+
const signature = await signer.signTypedData(typedData);
|
|
2371
|
+
verifySignature(typedData, signature, signer.address);
|
|
2372
|
+
|
|
2373
|
+
const cancelId = buildPayload["cancel_id"];
|
|
2374
|
+
if (!cancelId) {
|
|
2375
|
+
throw new HostedInvalidSignature(0, "cancel_id missing from hosted cancel build response");
|
|
2376
|
+
}
|
|
2377
|
+
const body: Record<string, unknown> = { cancel_id: cancelId, signature };
|
|
2378
|
+
|
|
2379
|
+
const pullTypedData = buildPayload["pull_typed_data"] as TypedData | undefined;
|
|
2380
|
+
if (pullTypedData) {
|
|
2381
|
+
const pullRoute = this._hostedCancelTypedDataRoute(true);
|
|
2382
|
+
validateTypedData(pullTypedData, pullRoute, this.walletAddress);
|
|
2383
|
+
const pullSig = await signer.signTypedData(pullTypedData);
|
|
2384
|
+
verifySignature(pullTypedData, pullSig, signer.address);
|
|
2385
|
+
body["pull_signature"] = pullSig;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
const cancelRoute = HOSTED_METHOD_ROUTES.get("cancelOrder")!;
|
|
2389
|
+
const data = await _tradingRequest(this, {
|
|
2390
|
+
method: cancelRoute.method,
|
|
2391
|
+
path: cancelRoute.path,
|
|
2392
|
+
body,
|
|
2393
|
+
});
|
|
2394
|
+
return orderFromV0(data as Record<string, unknown>);
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2344
2397
|
private _hostedCancelTypedDataRoute(isPull: boolean): string {
|
|
2345
2398
|
const venue = this.exchangeName;
|
|
2346
2399
|
if (venue === "polymarket") return "cancel_polymarket";
|