@predictasiax/api 2.0.0 → 2.1.0
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/CHANGELOG.md +24 -0
- package/dist/index.cjs +83 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +139 -3
- package/dist/index.d.ts +139 -3
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @predictasiax/api Changelog
|
|
2
2
|
|
|
3
|
+
## v2.1.0 — 2026-09-05
|
|
4
|
+
|
|
5
|
+
**Polymarket-parity + surpass surface.**
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **`pax.orders.placeBatch(orders)`** — POST `/v1/orders/batch`, up to 25 orders
|
|
9
|
+
per request, sequential CLOB processing, per-item results + summary.
|
|
10
|
+
Batch cap env-tunable server-side (BATCH_ORDERS_MAX default 25).
|
|
11
|
+
- **`pax.orders.cancelBatch(orderIds)`** — DELETE `/v1/orders/batch`, up to 50
|
|
12
|
+
cancels per request. Same shape as `placeBatch`.
|
|
13
|
+
- **`pax.fees`** namespace — new `FeesResource`:
|
|
14
|
+
- **`pax.fees.estimate(params)`** — GET `/v1/fees/estimate`, pre-trade 5-actor
|
|
15
|
+
split preview. Returns identical `fee` block shape as post-trade responses.
|
|
16
|
+
- **New types**: `BatchOrderResultItem`, `BatchCancelResultItem`, `BatchOrderSummary`,
|
|
17
|
+
`BatchOrdersResult`, `BatchCancelResult`, `FeeEstimateParams`, `FeeEstimate`.
|
|
18
|
+
- Auto Idempotency-Key is generated for batch POST/DELETE (server middleware
|
|
19
|
+
requires it globally on `/v1/*` mutations).
|
|
20
|
+
|
|
21
|
+
### Retained
|
|
22
|
+
- All v2.0.0 resources unchanged — batch is additive.
|
|
23
|
+
- Single-order `pax.orders.place` / `.cancel` continue to work; use them for
|
|
24
|
+
latency-sensitive single-order flows where batch would add serialization.
|
|
25
|
+
|
|
26
|
+
## v2.0.0 — 2026-09-05
|
|
3
27
|
## v2.0.0 — 2026-09-05
|
|
4
28
|
|
|
5
29
|
**Aligned with PAX API v2.0.0 (`https://api.predictasiax.com/v1`).**
|
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
AccountResource: () => AccountResource,
|
|
35
35
|
ApplyResource: () => ApplyResource,
|
|
36
36
|
CursorPage: () => CursorPage,
|
|
37
|
+
FeesResource: () => FeesResource,
|
|
37
38
|
GrantsResource: () => GrantsResource,
|
|
38
39
|
KeysResource: () => KeysResource,
|
|
39
40
|
MarketsResource: () => MarketsResource,
|
|
@@ -363,7 +364,7 @@ async function runWithRetry(fn, opts = {}) {
|
|
|
363
364
|
}
|
|
364
365
|
|
|
365
366
|
// src/http.ts
|
|
366
|
-
var VERSION = "2.
|
|
367
|
+
var VERSION = "2.1.0";
|
|
367
368
|
var ENV_URLS = {
|
|
368
369
|
production: "https://api.predictasiax.com/v1",
|
|
369
370
|
prod: "https://api.predictasiax.com/v1",
|
|
@@ -784,6 +785,30 @@ var AccountResource = class extends Resource {
|
|
|
784
785
|
}
|
|
785
786
|
};
|
|
786
787
|
|
|
788
|
+
// src/resources/fees.ts
|
|
789
|
+
var FeesResource = class extends Resource {
|
|
790
|
+
estimate(params, opts) {
|
|
791
|
+
const query = {
|
|
792
|
+
size: String(params.size),
|
|
793
|
+
price: String(params.price)
|
|
794
|
+
};
|
|
795
|
+
if (params.marketId) query.market_id = params.marketId;
|
|
796
|
+
if (params.side) query.side = params.side;
|
|
797
|
+
if (params.action) query.action = params.action;
|
|
798
|
+
if (params.vipDiscount != null) query.vip_discount = String(params.vipDiscount);
|
|
799
|
+
if (params.sharpMultiplier != null) query.sharp_multiplier = String(params.sharpMultiplier);
|
|
800
|
+
if (params.isMintTaker) query.is_mint_taker = "1";
|
|
801
|
+
if (params.isAmmMaker) query.is_amm_maker = "1";
|
|
802
|
+
if (params.acquisitionBuilderId) query.acquisition_builder_id = params.acquisitionBuilderId;
|
|
803
|
+
if (params.executionBuilderId) query.execution_builder_id = params.executionBuilderId;
|
|
804
|
+
if (params.operatorId) query.operator_id = params.operatorId;
|
|
805
|
+
if (params.marketCreatorId) query.market_creator_id = params.marketCreatorId;
|
|
806
|
+
return this._apiPromise(
|
|
807
|
+
() => this._http.request("GET", "/v1/fees/estimate", query, void 0, opts)
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
|
|
787
812
|
// src/resources/grants.ts
|
|
788
813
|
var GrantsResource = class extends Resource {
|
|
789
814
|
/** List every grant the authenticated user has, oldest last. */
|
|
@@ -973,6 +998,59 @@ var OrdersResource = class extends Resource {
|
|
|
973
998
|
opts
|
|
974
999
|
);
|
|
975
1000
|
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Place multiple orders in a single request (up to 25 per batch).
|
|
1003
|
+
*
|
|
1004
|
+
* Each order is processed sequentially by the CLOB engine (single-writer per
|
|
1005
|
+
* market). Response contains a `results` array with one entry per input order
|
|
1006
|
+
* (indexed) plus a `summary` with counts + duration. One bad order does not
|
|
1007
|
+
* fail the whole batch — inspect `results[i].ok` per item.
|
|
1008
|
+
*
|
|
1009
|
+
* Batch cap is env-tunable server-side (BATCH_ORDERS_MAX, default 25). Exceeding
|
|
1010
|
+
* returns `413 BATCH_TOO_LARGE`.
|
|
1011
|
+
*/
|
|
1012
|
+
placeBatch(orders, opts) {
|
|
1013
|
+
const wireOrders = orders.map((o) => {
|
|
1014
|
+
const body = {
|
|
1015
|
+
market_id: o.marketId,
|
|
1016
|
+
outcome_id: o.outcomeId,
|
|
1017
|
+
side: o.side,
|
|
1018
|
+
order_type: o.orderType,
|
|
1019
|
+
size: String(o.size)
|
|
1020
|
+
};
|
|
1021
|
+
if (o.price !== void 0) body.price = String(o.price);
|
|
1022
|
+
if (o.clientOrderId) body.client_order_id = o.clientOrderId;
|
|
1023
|
+
if (o.timeInForce) body.time_in_force = o.timeInForce;
|
|
1024
|
+
return body;
|
|
1025
|
+
});
|
|
1026
|
+
return this._apiPromise(
|
|
1027
|
+
() => this._http.request(
|
|
1028
|
+
"POST",
|
|
1029
|
+
"/v1/orders/batch",
|
|
1030
|
+
void 0,
|
|
1031
|
+
{ orders: wireOrders },
|
|
1032
|
+
opts
|
|
1033
|
+
)
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Cancel multiple orders in a single request (up to 50 per batch).
|
|
1038
|
+
*
|
|
1039
|
+
* Each cancel is processed sequentially by the CLOB engine. Response mirrors
|
|
1040
|
+
* `placeBatch` shape — inspect `results[i].ok` per item. Batch cap env-tunable
|
|
1041
|
+
* server-side (BATCH_CANCEL_MAX, default 50).
|
|
1042
|
+
*/
|
|
1043
|
+
cancelBatch(orderIds, opts) {
|
|
1044
|
+
return this._apiPromise(
|
|
1045
|
+
() => this._http.request(
|
|
1046
|
+
"DELETE",
|
|
1047
|
+
"/v1/orders/batch",
|
|
1048
|
+
void 0,
|
|
1049
|
+
{ orderIds },
|
|
1050
|
+
opts
|
|
1051
|
+
)
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
976
1054
|
};
|
|
977
1055
|
|
|
978
1056
|
// src/resources/sandbox.ts
|
|
@@ -1054,6 +1132,8 @@ var PaxClient = class {
|
|
|
1054
1132
|
apply;
|
|
1055
1133
|
// POST /v1/apply + GET /v1/apply/{code}
|
|
1056
1134
|
grants;
|
|
1135
|
+
fees;
|
|
1136
|
+
// v2.1+: GET /v1/fees/estimate
|
|
1057
1137
|
constructor(opts) {
|
|
1058
1138
|
this._http = new HttpClient(opts);
|
|
1059
1139
|
this.markets = new MarketsResource(this._http);
|
|
@@ -1065,6 +1145,7 @@ var PaxClient = class {
|
|
|
1065
1145
|
this.sandboxKeys = new SandboxKeysResource(this._http);
|
|
1066
1146
|
this.apply = new ApplyResource(this._http);
|
|
1067
1147
|
this.grants = new GrantsResource(this._http);
|
|
1148
|
+
this.fees = new FeesResource(this._http);
|
|
1068
1149
|
}
|
|
1069
1150
|
get baseUrl() {
|
|
1070
1151
|
return this._http.baseUrl;
|
|
@@ -1338,6 +1419,7 @@ var PaxWSClient = class {
|
|
|
1338
1419
|
AccountResource,
|
|
1339
1420
|
ApplyResource,
|
|
1340
1421
|
CursorPage,
|
|
1422
|
+
FeesResource,
|
|
1341
1423
|
GrantsResource,
|
|
1342
1424
|
KeysResource,
|
|
1343
1425
|
MarketsResource,
|