pmxtjs 2.19.5 → 2.19.6
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 +1 -0
- package/dist/esm/pmxt/client.js +22 -0
- package/dist/pmxt/client.d.ts +1 -0
- package/dist/pmxt/client.js +22 -0
- package/generated/package.json +1 -1
- package/package.json +2 -2
- package/pmxt/client.ts +22 -0
|
@@ -68,6 +68,7 @@ export declare abstract class Exchange {
|
|
|
68
68
|
fetchMarket(params?: any): Promise<UnifiedMarket>;
|
|
69
69
|
fetchEvent(params?: any): Promise<UnifiedEvent>;
|
|
70
70
|
fetchOrderBook(id: string): Promise<OrderBook>;
|
|
71
|
+
submitOrder(built: any): Promise<Order>;
|
|
71
72
|
cancelOrder(orderId: string): Promise<Order>;
|
|
72
73
|
fetchOrder(orderId: string): Promise<Order>;
|
|
73
74
|
fetchOpenOrders(marketId?: string): Promise<Order[]>;
|
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -433,6 +433,28 @@ export class Exchange {
|
|
|
433
433
|
throw new Error(`Failed to fetchOrderBook: ${error}`);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
+
async submitOrder(built) {
|
|
437
|
+
await this.initPromise;
|
|
438
|
+
try {
|
|
439
|
+
const args = [];
|
|
440
|
+
args.push(built);
|
|
441
|
+
const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/submitOrder`, {
|
|
442
|
+
method: 'POST',
|
|
443
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
444
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
445
|
+
});
|
|
446
|
+
if (!response.ok) {
|
|
447
|
+
const error = await response.json().catch(() => ({}));
|
|
448
|
+
throw new Error(error.error?.message || response.statusText);
|
|
449
|
+
}
|
|
450
|
+
const json = await response.json();
|
|
451
|
+
const data = this.handleResponse(json);
|
|
452
|
+
return convertOrder(data);
|
|
453
|
+
}
|
|
454
|
+
catch (error) {
|
|
455
|
+
throw new Error(`Failed to submitOrder: ${error}`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
436
458
|
async cancelOrder(orderId) {
|
|
437
459
|
await this.initPromise;
|
|
438
460
|
try {
|
package/dist/pmxt/client.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export declare abstract class Exchange {
|
|
|
68
68
|
fetchMarket(params?: any): Promise<UnifiedMarket>;
|
|
69
69
|
fetchEvent(params?: any): Promise<UnifiedEvent>;
|
|
70
70
|
fetchOrderBook(id: string): Promise<OrderBook>;
|
|
71
|
+
submitOrder(built: any): Promise<Order>;
|
|
71
72
|
cancelOrder(orderId: string): Promise<Order>;
|
|
72
73
|
fetchOrder(orderId: string): Promise<Order>;
|
|
73
74
|
fetchOpenOrders(marketId?: string): Promise<Order[]>;
|
package/dist/pmxt/client.js
CHANGED
|
@@ -436,6 +436,28 @@ class Exchange {
|
|
|
436
436
|
throw new Error(`Failed to fetchOrderBook: ${error}`);
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
+
async submitOrder(built) {
|
|
440
|
+
await this.initPromise;
|
|
441
|
+
try {
|
|
442
|
+
const args = [];
|
|
443
|
+
args.push(built);
|
|
444
|
+
const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/submitOrder`, {
|
|
445
|
+
method: 'POST',
|
|
446
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
447
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
448
|
+
});
|
|
449
|
+
if (!response.ok) {
|
|
450
|
+
const error = await response.json().catch(() => ({}));
|
|
451
|
+
throw new Error(error.error?.message || response.statusText);
|
|
452
|
+
}
|
|
453
|
+
const json = await response.json();
|
|
454
|
+
const data = this.handleResponse(json);
|
|
455
|
+
return convertOrder(data);
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
throw new Error(`Failed to submitOrder: ${error}`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
439
461
|
async cancelOrder(orderId) {
|
|
440
462
|
await this.initPromise;
|
|
441
463
|
try {
|
package/generated/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.6",
|
|
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.19.
|
|
46
|
+
"pmxt-core": "2.19.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/jest": "^30.0.0",
|
package/pmxt/client.ts
CHANGED
|
@@ -517,6 +517,28 @@ export abstract class Exchange {
|
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
+
async submitOrder(built: any): Promise<Order> {
|
|
521
|
+
await this.initPromise;
|
|
522
|
+
try {
|
|
523
|
+
const args: any[] = [];
|
|
524
|
+
args.push(built);
|
|
525
|
+
const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/submitOrder`, {
|
|
526
|
+
method: 'POST',
|
|
527
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
528
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
529
|
+
});
|
|
530
|
+
if (!response.ok) {
|
|
531
|
+
const error = await response.json().catch(() => ({}));
|
|
532
|
+
throw new Error(error.error?.message || response.statusText);
|
|
533
|
+
}
|
|
534
|
+
const json = await response.json();
|
|
535
|
+
const data = this.handleResponse(json);
|
|
536
|
+
return convertOrder(data);
|
|
537
|
+
} catch (error) {
|
|
538
|
+
throw new Error(`Failed to submitOrder: ${error}`);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
520
542
|
async cancelOrder(orderId: string): Promise<Order> {
|
|
521
543
|
await this.initPromise;
|
|
522
544
|
try {
|