@pulsepairs/sdk 0.5.1 → 0.5.2

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/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, type ApiConfig, type Balance, 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 Stats, type Trade, type Version, } from "./types.js";
10
+ export { OrderType, OrderSide, Option, takerPriceBps, type ApiConfig, type Balance, 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 Stats, type Trade, type Version, } from "./types.js";
package/dist/index.js CHANGED
@@ -25,4 +25,4 @@ export { buildApproveSettlementTx, buildInstallOrderSessionTx, signWithOrderSess
25
25
  // contract). `UpDownHttpClient.getPnl` is the batteries-included wrapper.
26
26
  export { PRICE_BPS_SCALE, WIN_MARK_BPS, LOSE_MARK_BPS, DEFAULT_USDT_DECIMALS, atomicToUsdt, markValueAtomic, midBps, markForOption, isResolvedWinner, positionPnl, feesPaidByWallet, portfolioPnl, computePortfolioPnl, } from "./pnl.js";
27
27
  // Types
28
- export { OrderType, OrderSide, Option, } from "./types.js";
28
+ export { OrderType, OrderSide, Option, takerPriceBps, } from "./types.js";
package/dist/types.d.ts CHANGED
@@ -140,18 +140,40 @@ export type Position = {
140
140
  export type Trade = {
141
141
  tradeId: string;
142
142
  market: string;
143
+ /** The TAKER leg's option (1=UP, 2=DOWN). On a MINT/MERGE the maker leg is
144
+ * the opposite option. */
143
145
  option: number;
144
146
  buyOrderId: string;
145
147
  sellOrderId: string;
148
+ /** NORMAL: the buyer. MINT/MERGE: the aggressor (taker) — a buyer on MINT,
149
+ * a seller on MERGE. */
146
150
  buyer: string;
151
+ /** NORMAL: the seller. MINT/MERGE: the resting maker, on the OPPOSITE option
152
+ * to `option`. */
147
153
  seller: string;
154
+ /** Basis points — the resting MAKER's pegged execution price. On a
155
+ * complementary fill the taker executed at the complement; render taker
156
+ * fills with `takerPrice`, not this. */
148
157
  price: number;
149
158
  amount: string;
150
159
  platformFee: string;
151
160
  makerFee: string;
152
161
  settlementStatus: string;
153
162
  createdAt: string;
163
+ /** Match geometry. NORMAL = same-option fill. MINT/MERGE = complementary
164
+ * cross (opposite-option legs). Optional so a pre-2026-07-17 backend
165
+ * (field absent) degrades rather than breaking a consumer. */
166
+ matchType?: "NORMAL" | "MINT" | "MERGE";
167
+ /** Basis points the taker actually executed at: `price` on NORMAL,
168
+ * `10000 − price` on MINT/MERGE. Prefer this over `price` when rendering a
169
+ * wallet's own fills. Optional for the same back-compat reason. */
170
+ takerPrice?: number;
154
171
  };
172
+ /** The price the AGGRESSOR paid/received per share, in bps. Mirrors the
173
+ * backend's `takerPriceBps`: the complement on a complementary fill, else the
174
+ * row price. Falls back to computing the complement if a row predates the
175
+ * `takerPrice` field. */
176
+ export declare function takerPriceBps(trade: Pick<Trade, "price" | "matchType" | "takerPrice">): number;
155
177
  export type OrderStatus = "OPEN" | "PARTIALLY_FILLED" | "FILLED" | "CANCEL_PENDING" | "CANCELLED" | string;
156
178
  export type OrderRow = {
157
179
  orderId: string;
package/dist/types.js CHANGED
@@ -18,3 +18,14 @@ export const Option = {
18
18
  UP: 1,
19
19
  DOWN: 2,
20
20
  };
21
+ /** The price the AGGRESSOR paid/received per share, in bps. Mirrors the
22
+ * backend's `takerPriceBps`: the complement on a complementary fill, else the
23
+ * row price. Falls back to computing the complement if a row predates the
24
+ * `takerPrice` field. */
25
+ export function takerPriceBps(trade) {
26
+ if (typeof trade.takerPrice === "number")
27
+ return trade.takerPrice;
28
+ return trade.matchType === "MINT" || trade.matchType === "MERGE"
29
+ ? 10000 - trade.price
30
+ : trade.price;
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulsepairs/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Standalone SDK for the UpDown (PulsePairs) up/down prediction markets — 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",