@pulsepairs/sdk 0.9.0 → 0.9.1
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/README.md +19 -5
- package/dist/http.d.ts +4 -1
- package/dist/http.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +28 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -475,11 +475,25 @@ would otherwise see each other's half-applied state. Both cap at 20 per request.
|
|
|
475
475
|
UPND_INTEGRATION=1 PRIVATE_KEY=0x… npm run test:integration
|
|
476
476
|
```
|
|
477
477
|
|
|
478
|
-
It rests an order, amends it, bulk-places two,
|
|
479
|
-
everything in a `finally` — including on failure.
|
|
480
|
-
to run against prod without `UPND_ALLOW_PROD=1`,
|
|
481
|
-
and only dev's USDT is play money. Needs a live 5m
|
|
482
|
-
the keeper has to be cycling.
|
|
478
|
+
It grants the collateral allowance, rests an order, amends it, bulk-places two,
|
|
479
|
+
bulk-amends those, and cancels everything in a `finally` — including on failure.
|
|
480
|
+
It defaults to dev and refuses to run against prod without `UPND_ALLOW_PROD=1`,
|
|
481
|
+
because it places real orders and only dev's USDT is play money. Needs a live 5m
|
|
482
|
+
market with >120s left, so the keeper has to be cycling.
|
|
483
|
+
|
|
484
|
+
The key needs mock USDT and a little gas ETH. On dev the public faucet gives
|
|
485
|
+
both in one call:
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
curl -X POST https://dev-api-updown.rain.trade/test/devmint \
|
|
489
|
+
-H 'Content-Type: application/json' \
|
|
490
|
+
-d '{"address":"0x…","amount":"100000000"}'
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
The **allowance is granted by the test itself**, not by hand — a freshly
|
|
494
|
+
deployed Settlement has no approvals from anyone, and requiring a manual
|
|
495
|
+
approve made "run the acceptance test" a two-step nobody had written down. Use a
|
|
496
|
+
throwaway key: the faucet is public, so nothing valuable should sit on it.
|
|
483
497
|
|
|
484
498
|
---
|
|
485
499
|
|
package/dist/http.d.ts
CHANGED
|
@@ -112,7 +112,10 @@ export declare class UpDownHttpClient {
|
|
|
112
112
|
* amend's outcome in the body, so a rejection never reaches `parseJson`'s
|
|
113
113
|
* throw. `bulkFailures()` below exists to make that hard to forget.
|
|
114
114
|
*
|
|
115
|
-
* Results are positional: `results[i]` is the outcome of `amends[i]
|
|
115
|
+
* Results are positional: `results[i]` is the outcome of `amends[i]`, and a
|
|
116
|
+
* successful entry NESTS the replacement — `results[i].order.id`, not
|
|
117
|
+
* `results[i].id`. That differs from the single `amendOrder` above, which
|
|
118
|
+
* spreads the order at the top level; the asymmetry is the server's.
|
|
116
119
|
*
|
|
117
120
|
* Server-side these run SERIALLY, not concurrently — two amends racing on
|
|
118
121
|
* neighbouring price levels would otherwise see each other's half-applied
|
package/dist/http.js
CHANGED
|
@@ -215,7 +215,10 @@ export class UpDownHttpClient {
|
|
|
215
215
|
* amend's outcome in the body, so a rejection never reaches `parseJson`'s
|
|
216
216
|
* throw. `bulkFailures()` below exists to make that hard to forget.
|
|
217
217
|
*
|
|
218
|
-
* Results are positional: `results[i]` is the outcome of `amends[i]
|
|
218
|
+
* Results are positional: `results[i]` is the outcome of `amends[i]`, and a
|
|
219
|
+
* successful entry NESTS the replacement — `results[i].order.id`, not
|
|
220
|
+
* `results[i].id`. That differs from the single `amendOrder` above, which
|
|
221
|
+
* spreads the order at the top level; the asymmetry is the server's.
|
|
219
222
|
*
|
|
220
223
|
* Server-side these run SERIALLY, not concurrently — two amends racing on
|
|
221
224
|
* neighbouring price levels would otherwise see each other's half-applied
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export { readOnChainHolderShares, reconcileFills, reportedFromPositions, type On
|
|
|
7
7
|
export { UpDownAccountKitSigner, bareErc1271Signer, stripErc6492Wrapper, isErc6492Signature, type UpDownAccountKitConfig, type Eip1193Provider, type GrantSessionResult, type RawTypedDataSigner, } from "./accountKit.js";
|
|
8
8
|
export { buildApproveSettlementTx, buildInstallOrderSessionTx, signWithOrderSession, type RawTransaction, type OrderSessionRecord, } from "./accountKit.js";
|
|
9
9
|
export { PRICE_BPS_SCALE, WIN_MARK_BPS, LOSE_MARK_BPS, DEFAULT_USDT_DECIMALS, atomicToUsdt, markValueAtomic, midBps, markForOption, isResolvedWinner, positionPnl, feesPaidByWallet, portfolioPnl, computePortfolioPnl, type MarkSource, type PositionPnl, type PortfolioPnl, type PositionPnlOptions, } from "./pnl.js";
|
|
10
|
-
export { OrderType, OrderSide, Option, takerPriceBps, type AmendOrderBody, type AmendOrderResult, type ApiConfig, type Balance, type BulkAmendBody, type BulkAmendResults, type BulkFailure, type BulkOrdersBody, type BulkOrdersResults, type CancelOrderBody, type Eip712Domain, type MarketDetail, type MarketListItem, type OptionValue, type OrderBookFull, type OrderBookLevel, type OrderBookSide, type OrderRow, type OrderSideKey, type OrderSideValue, type OrderStatus, type OrderTypeKey, type OrderTypeValue, type OrdersResponse, type PairConfig, type PairSymbol, type PostOrderBody, type Position, type SubmittedOrder, type Stats, type Trade, type Version, } from "./types.js";
|
|
10
|
+
export { OrderType, OrderSide, Option, takerPriceBps, type AmendOrderBody, type AmendOrderResult, type ApiConfig, type Balance, type BulkAmendBody, type BulkAmendResults, type BulkAmendSuccess, type BulkFailure, type BulkOrdersBody, type BulkOrdersResults, type CancelOrderBody, type Eip712Domain, type MarketDetail, type MarketListItem, type OptionValue, type OrderBookFull, type OrderBookLevel, type OrderBookSide, type OrderRow, type OrderSideKey, type OrderSideValue, type OrderStatus, type OrderTypeKey, type OrderTypeValue, type OrdersResponse, type PairConfig, type PairSymbol, type PostOrderBody, type Position, type SubmittedOrder, type Stats, type Trade, type Version, } from "./types.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -315,10 +315,35 @@ export type AmendOrderResult = SubmittedOrder & {
|
|
|
315
315
|
export type BulkAmendBody = {
|
|
316
316
|
amends: AmendOrderBody[];
|
|
317
317
|
};
|
|
318
|
+
/**
|
|
319
|
+
* One successful entry of a bulk amend.
|
|
320
|
+
*
|
|
321
|
+
* NOTE THE SHAPE DIFFERS FROM THE SINGLE ROUTE, and this is the server's
|
|
322
|
+
* asymmetry rather than a choice made here. `POST /orders/amend` SPREADS the
|
|
323
|
+
* replacement order at the top level, so its id is `res.id`.
|
|
324
|
+
* `POST /orders/amend/bulk` NESTS it, so the id is `results[i].order.id` —
|
|
325
|
+
* matching `POST /orders/bulk`, which also nests.
|
|
326
|
+
*
|
|
327
|
+
* Typed wrongly in 0.9.0 (as the single route's flat shape), which made
|
|
328
|
+
* `results[i].id` read `undefined` for every entry. Caught by the live
|
|
329
|
+
* round-trip against dev, not by the stubbed tests — those used a fixture
|
|
330
|
+
* written from the same wrong assumption, so they agreed with themselves.
|
|
331
|
+
*/
|
|
332
|
+
export type BulkAmendSuccess = {
|
|
333
|
+
ok: true;
|
|
334
|
+
/** The replacement, nested — NOT spread, unlike `POST /orders/amend`. */
|
|
335
|
+
order: SubmittedOrder;
|
|
336
|
+
/** Echo of the `cancelOrderId` that was retired. */
|
|
337
|
+
replaced: string;
|
|
338
|
+
/** Whether the replacement kept the original's queue position. */
|
|
339
|
+
priorityKept: boolean;
|
|
340
|
+
/** Atomic USDT already filled on the ORIGINAL before it was retired. */
|
|
341
|
+
filled: string;
|
|
342
|
+
/** Atomic USDT that was still resting and has moved to the replacement. */
|
|
343
|
+
remaining: string;
|
|
344
|
+
};
|
|
318
345
|
export type BulkAmendResults = {
|
|
319
|
-
results: Array<
|
|
320
|
-
ok: true;
|
|
321
|
-
} & AmendOrderResult) | BulkFailure>;
|
|
346
|
+
results: Array<BulkAmendSuccess | BulkFailure>;
|
|
322
347
|
};
|
|
323
348
|
/** `POST /orders/bulk` — orders fan out CONCURRENTLY server-side. */
|
|
324
349
|
export type BulkOrdersBody = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulsepairs/sdk",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Standalone SDK for the UpDown (PulsePairs) up/down prediction markets \u2014 matcher REST/WS client, EIP-712 order signing, trade-math, and Alchemy Account Kit (smart-account) order signing for rain.trade integration.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|