pmxtjs 2.50.9 → 2.50.11
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.js +24 -2
- package/dist/pmxt/client.js +22 -0
- package/generated/package.json +1 -1
- package/package.json +2 -2
- package/pmxt/client.ts +22 -0
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -17,8 +17,8 @@ import { logger } from "./logger.js";
|
|
|
17
17
|
// import names below are the conventional ones from the plan. Cross-module
|
|
18
18
|
// "Cannot find module" errors during the parallel landing window resolve
|
|
19
19
|
// once the matching files exist.
|
|
20
|
-
import { HOSTED_TRADING_VENUES, _tradingRequest, HOSTED_METHOD_ROUTES, } from "./hosted-routing.js";
|
|
21
|
-
import { orderFromV0, to6dec, } from "./hosted-mappers.js";
|
|
20
|
+
import { HOSTED_TRADING_VENUES, _tradingRequest, resolveWalletAddress, formatRoutePath, HOSTED_METHOD_ROUTES, } from "./hosted-routing.js";
|
|
21
|
+
import { orderFromV0, positionFromV0, balanceFromV0, to6dec, } from "./hosted-mappers.js";
|
|
22
22
|
import { validateTypedData, validateEconomics, verifySignature, } from "./hosted-typed-data.js";
|
|
23
23
|
import { EthersSigner } from "./signers.js";
|
|
24
24
|
import { Escrow } from "./escrow.js";
|
|
@@ -979,6 +979,12 @@ export class Exchange {
|
|
|
979
979
|
}
|
|
980
980
|
async fetchOrder(orderId) {
|
|
981
981
|
await this.initPromise;
|
|
982
|
+
if (this.isHosted) {
|
|
983
|
+
const route = HOSTED_METHOD_ROUTES.get("fetchOrder");
|
|
984
|
+
const path = formatRoutePath(route, { order_id: orderId });
|
|
985
|
+
const data = await _tradingRequest(this, { method: route.method, path });
|
|
986
|
+
return orderFromV0(data);
|
|
987
|
+
}
|
|
982
988
|
try {
|
|
983
989
|
const args = [];
|
|
984
990
|
args.push(orderId);
|
|
@@ -1118,6 +1124,14 @@ export class Exchange {
|
|
|
1118
1124
|
}
|
|
1119
1125
|
async fetchPositions(address) {
|
|
1120
1126
|
await this.initPromise;
|
|
1127
|
+
if (this.isHosted) {
|
|
1128
|
+
const resolvedAddress = resolveWalletAddress(this, address);
|
|
1129
|
+
const route = HOSTED_METHOD_ROUTES.get("fetchPositions");
|
|
1130
|
+
const path = formatRoutePath(route, { address: resolvedAddress });
|
|
1131
|
+
const data = await _tradingRequest(this, { method: route.method, path });
|
|
1132
|
+
const list = Array.isArray(data) ? data : [];
|
|
1133
|
+
return list.map((p) => positionFromV0(p));
|
|
1134
|
+
}
|
|
1121
1135
|
try {
|
|
1122
1136
|
const args = [];
|
|
1123
1137
|
if (address !== undefined)
|
|
@@ -1146,6 +1160,14 @@ export class Exchange {
|
|
|
1146
1160
|
}
|
|
1147
1161
|
async fetchBalance(address) {
|
|
1148
1162
|
await this.initPromise;
|
|
1163
|
+
if (this.isHosted) {
|
|
1164
|
+
const resolvedAddress = resolveWalletAddress(this, address);
|
|
1165
|
+
const route = HOSTED_METHOD_ROUTES.get("fetchBalance");
|
|
1166
|
+
const path = formatRoutePath(route, { address: resolvedAddress });
|
|
1167
|
+
const data = await _tradingRequest(this, { method: route.method, path });
|
|
1168
|
+
const list = Array.isArray(data) ? data : [];
|
|
1169
|
+
return list.map((b) => balanceFromV0(b));
|
|
1170
|
+
}
|
|
1149
1171
|
try {
|
|
1150
1172
|
const args = [];
|
|
1151
1173
|
if (address !== undefined)
|
package/dist/pmxt/client.js
CHANGED
|
@@ -982,6 +982,12 @@ class Exchange {
|
|
|
982
982
|
}
|
|
983
983
|
async fetchOrder(orderId) {
|
|
984
984
|
await this.initPromise;
|
|
985
|
+
if (this.isHosted) {
|
|
986
|
+
const route = hosted_routing_js_1.HOSTED_METHOD_ROUTES.get("fetchOrder");
|
|
987
|
+
const path = (0, hosted_routing_js_1.formatRoutePath)(route, { order_id: orderId });
|
|
988
|
+
const data = await (0, hosted_routing_js_1._tradingRequest)(this, { method: route.method, path });
|
|
989
|
+
return (0, hosted_mappers_js_1.orderFromV0)(data);
|
|
990
|
+
}
|
|
985
991
|
try {
|
|
986
992
|
const args = [];
|
|
987
993
|
args.push(orderId);
|
|
@@ -1121,6 +1127,14 @@ class Exchange {
|
|
|
1121
1127
|
}
|
|
1122
1128
|
async fetchPositions(address) {
|
|
1123
1129
|
await this.initPromise;
|
|
1130
|
+
if (this.isHosted) {
|
|
1131
|
+
const resolvedAddress = (0, hosted_routing_js_1.resolveWalletAddress)(this, address);
|
|
1132
|
+
const route = hosted_routing_js_1.HOSTED_METHOD_ROUTES.get("fetchPositions");
|
|
1133
|
+
const path = (0, hosted_routing_js_1.formatRoutePath)(route, { address: resolvedAddress });
|
|
1134
|
+
const data = await (0, hosted_routing_js_1._tradingRequest)(this, { method: route.method, path });
|
|
1135
|
+
const list = Array.isArray(data) ? data : [];
|
|
1136
|
+
return list.map((p) => (0, hosted_mappers_js_1.positionFromV0)(p));
|
|
1137
|
+
}
|
|
1124
1138
|
try {
|
|
1125
1139
|
const args = [];
|
|
1126
1140
|
if (address !== undefined)
|
|
@@ -1149,6 +1163,14 @@ class Exchange {
|
|
|
1149
1163
|
}
|
|
1150
1164
|
async fetchBalance(address) {
|
|
1151
1165
|
await this.initPromise;
|
|
1166
|
+
if (this.isHosted) {
|
|
1167
|
+
const resolvedAddress = (0, hosted_routing_js_1.resolveWalletAddress)(this, address);
|
|
1168
|
+
const route = hosted_routing_js_1.HOSTED_METHOD_ROUTES.get("fetchBalance");
|
|
1169
|
+
const path = (0, hosted_routing_js_1.formatRoutePath)(route, { address: resolvedAddress });
|
|
1170
|
+
const data = await (0, hosted_routing_js_1._tradingRequest)(this, { method: route.method, path });
|
|
1171
|
+
const list = Array.isArray(data) ? data : [];
|
|
1172
|
+
return list.map((b) => (0, hosted_mappers_js_1.balanceFromV0)(b));
|
|
1173
|
+
}
|
|
1152
1174
|
try {
|
|
1153
1175
|
const args = [];
|
|
1154
1176
|
if (address !== undefined)
|
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.11",
|
|
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.11",
|
|
47
47
|
"ws": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
package/pmxt/client.ts
CHANGED
|
@@ -1188,6 +1188,12 @@ export abstract class Exchange {
|
|
|
1188
1188
|
|
|
1189
1189
|
async fetchOrder(orderId: string): Promise<Order> {
|
|
1190
1190
|
await this.initPromise;
|
|
1191
|
+
if (this.isHosted) {
|
|
1192
|
+
const route = HOSTED_METHOD_ROUTES.get("fetchOrder")!;
|
|
1193
|
+
const path = formatRoutePath(route, { order_id: orderId });
|
|
1194
|
+
const data = await _tradingRequest(this, { method: route.method, path });
|
|
1195
|
+
return orderFromV0(data as Record<string, unknown>);
|
|
1196
|
+
}
|
|
1191
1197
|
try {
|
|
1192
1198
|
const args: any[] = [];
|
|
1193
1199
|
args.push(orderId);
|
|
@@ -1318,6 +1324,14 @@ export abstract class Exchange {
|
|
|
1318
1324
|
|
|
1319
1325
|
async fetchPositions(address?: string): Promise<Position[]> {
|
|
1320
1326
|
await this.initPromise;
|
|
1327
|
+
if (this.isHosted) {
|
|
1328
|
+
const resolvedAddress = resolveWalletAddress(this, address);
|
|
1329
|
+
const route = HOSTED_METHOD_ROUTES.get("fetchPositions")!;
|
|
1330
|
+
const path = formatRoutePath(route, { address: resolvedAddress });
|
|
1331
|
+
const data = await _tradingRequest(this, { method: route.method, path });
|
|
1332
|
+
const list = Array.isArray(data) ? data : [];
|
|
1333
|
+
return list.map((p) => positionFromV0(p as Record<string, unknown>));
|
|
1334
|
+
}
|
|
1321
1335
|
try {
|
|
1322
1336
|
const args: any[] = [];
|
|
1323
1337
|
if (address !== undefined) args.push(address);
|
|
@@ -1344,6 +1358,14 @@ export abstract class Exchange {
|
|
|
1344
1358
|
|
|
1345
1359
|
async fetchBalance(address?: string): Promise<Balance[]> {
|
|
1346
1360
|
await this.initPromise;
|
|
1361
|
+
if (this.isHosted) {
|
|
1362
|
+
const resolvedAddress = resolveWalletAddress(this, address);
|
|
1363
|
+
const route = HOSTED_METHOD_ROUTES.get("fetchBalance")!;
|
|
1364
|
+
const path = formatRoutePath(route, { address: resolvedAddress });
|
|
1365
|
+
const data = await _tradingRequest(this, { method: route.method, path });
|
|
1366
|
+
const list = Array.isArray(data) ? data : [];
|
|
1367
|
+
return list.map((b) => balanceFromV0(b as Record<string, unknown>));
|
|
1368
|
+
}
|
|
1347
1369
|
try {
|
|
1348
1370
|
const args: any[] = [];
|
|
1349
1371
|
if (address !== undefined) args.push(address);
|