@stryke-xyz/premarket-sdk 1.1.4 → 1.1.7
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/cjs/api/orderbook-api/deserializers.js +9 -3
- package/dist/cjs/api/orderbook-api/index.js +6 -3
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/shared/types.js +12 -4
- package/dist/esm/api/orderbook-api/deserializers.js +9 -3
- package/dist/esm/api/orderbook-api/index.js +6 -3
- package/dist/esm/package.json +1 -1
- package/dist/esm/shared/types.js +12 -4
- package/dist/types/api/orderbook-api/deserializers.d.ts +6 -1
- package/dist/types/api/orderbook-api/index.d.ts +8 -5
- package/dist/types/shared/types.d.ts +74 -9
- package/package.json +1 -1
|
@@ -98,15 +98,17 @@ function _object_spread_props(target, source) {
|
|
|
98
98
|
* Note: Most endpoints now return pre-formatted string values,
|
|
99
99
|
* so minimal deserialization is needed. These helpers are provided
|
|
100
100
|
* for cases where BigInt conversion is preferred on the client side.
|
|
101
|
-
*/ function parseOptionalBigInt(value) {
|
|
101
|
+
*/ /** @deprecated Use `instruments` instead. */ function parseOptionalBigInt(value) {
|
|
102
102
|
return value == null ? null : BigInt(value);
|
|
103
103
|
}
|
|
104
104
|
function parseIsCall(value) {
|
|
105
105
|
return value === true || value === 1;
|
|
106
106
|
}
|
|
107
107
|
function submarketToBigInt(submarket) {
|
|
108
|
+
var _submarket_marketId;
|
|
108
109
|
return {
|
|
109
110
|
id: submarket.id,
|
|
111
|
+
marketId: (_submarket_marketId = submarket.marketId) !== null && _submarket_marketId !== void 0 ? _submarket_marketId : submarket.id,
|
|
110
112
|
name: submarket.name,
|
|
111
113
|
tokenAddress: submarket.tokenAddress,
|
|
112
114
|
tokenDecimals: submarket.tokenDecimals,
|
|
@@ -148,6 +150,7 @@ function submarketToBigInt(submarket) {
|
|
|
148
150
|
/**
|
|
149
151
|
* Convert string market fields to BigInt while preserving addresses and labels.
|
|
150
152
|
*/ function marketToBigInt(market) {
|
|
153
|
+
var _market_logoUri, _market_hasFinalTick;
|
|
151
154
|
var baseMarket = {
|
|
152
155
|
id: market.id,
|
|
153
156
|
groupId: market.groupId,
|
|
@@ -163,14 +166,17 @@ function submarketToBigInt(submarket) {
|
|
|
163
166
|
collateralToken: market.collateralToken,
|
|
164
167
|
collateralDecimals: market.collateralDecimals,
|
|
165
168
|
maxDecimals: parseOptionalBigInt(market.maxDecimals),
|
|
166
|
-
marketType: market.marketType
|
|
169
|
+
marketType: market.marketType,
|
|
170
|
+
logoUri: (_market_logoUri = market.logoUri) !== null && _market_logoUri !== void 0 ? _market_logoUri : null,
|
|
171
|
+
hasFinalTick: (_market_hasFinalTick = market.hasFinalTick) !== null && _market_hasFinalTick !== void 0 ? _market_hasFinalTick : false
|
|
167
172
|
};
|
|
168
173
|
if (market.type === "erc20") {
|
|
174
|
+
var _ref, _market_instruments;
|
|
169
175
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
|
170
176
|
type: "erc20",
|
|
171
177
|
underlying: market.underlying,
|
|
172
178
|
underlyingDecimals: market.underlyingDecimals,
|
|
173
|
-
|
|
179
|
+
instruments: ((_ref = (_market_instruments = market.instruments) !== null && _market_instruments !== void 0 ? _market_instruments : market.submarkets) !== null && _ref !== void 0 ? _ref : []).map(submarketToBigInt)
|
|
174
180
|
});
|
|
175
181
|
}
|
|
176
182
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
|
@@ -708,7 +708,9 @@ function _ts_generator(thisArg, body) {
|
|
|
708
708
|
// USER POSITION & PNL METHODS
|
|
709
709
|
// ============================================================================
|
|
710
710
|
/**
|
|
711
|
-
* Returns
|
|
711
|
+
* Returns enriched user positions including market name, instrument name,
|
|
712
|
+
* logo, collateral info, PnL, and role (isOPrm / isOpen).
|
|
713
|
+
* Also includes a `grouped` array keyed by market.
|
|
712
714
|
*/ function getUserPositions(userAddress) {
|
|
713
715
|
return _async_to_generator(function() {
|
|
714
716
|
return _ts_generator(this, function(_state) {
|
|
@@ -826,8 +828,9 @@ function _ts_generator(thisArg, body) {
|
|
|
826
828
|
// HISTORY METHODS
|
|
827
829
|
// ============================================================================
|
|
828
830
|
/**
|
|
829
|
-
* Returns grouped user history
|
|
830
|
-
*
|
|
831
|
+
* Returns grouped + enriched user history. Every event carries marketName,
|
|
832
|
+
* instrumentName, logoUri, collateralDecimals, collateralToken, and a `type`
|
|
833
|
+
* discriminator. The `timeline` field is a flat chronological list of all events.
|
|
831
834
|
*/ function getUserHistories(userAddress, opts) {
|
|
832
835
|
return _async_to_generator(function() {
|
|
833
836
|
var limit, marketId, tokenId;
|
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@stryke-xyz/premarket-sdk","version":"1.1.
|
|
1
|
+
{"name":"@stryke-xyz/premarket-sdk","version":"1.1.7","type":"commonjs"}
|
package/dist/cjs/shared/types.js
CHANGED
|
@@ -25,16 +25,24 @@ Object.defineProperty(exports, "OrderStatus", {
|
|
|
25
25
|
OrderStatus["CANCELLED"] = "CANCELLED";
|
|
26
26
|
OrderStatus["EXPIRED"] = "EXPIRED";
|
|
27
27
|
return OrderStatus;
|
|
28
|
-
}({})
|
|
28
|
+
}({})// Enriched by the order-queue when returning user orders
|
|
29
|
+
/** If true, amount is in maker's makingAmount units. If false, amount is in maker's takingAmount units. */ /** The amount to pass to Exchange.fillOrder */ /** Whether fillAmount is in maker's makingAmount units (true) or takingAmount units (false) */ /** True if the user-submitted order's `amount` is in maker's makingAmount units. */ /** Set to "awaiting match" when the engine's match tail did not arrive within the API's wait window. */ // ============================================================================
|
|
29
30
|
// MARKET TYPES
|
|
30
31
|
// ============================================================================
|
|
31
|
-
// ============================================================================
|
|
32
|
+
/** True when the on-chain FinalTick event has been indexed for this market's current expiry. */ /** Numeric market_id of this sub-market (same as id for standalone, member id for grouped). */ /** Sub-markets / instruments in this ERC20 group. */ /** @deprecated Use `instruments` instead. Kept for backward compatibility. */ // ============================================================================
|
|
32
33
|
// POSITION & PNL TYPES
|
|
33
34
|
// ============================================================================
|
|
34
|
-
/** PnL contribution from limit-order trades */ /** PnL contribution from redemption / exercise settlements */
|
|
35
|
+
/** PnL contribution from limit-order trades */ /** PnL contribution from redemption / exercise settlements */ /**
|
|
36
|
+
* Market/instrument metadata the API attaches to positions and history events.
|
|
37
|
+
* All fields are optional so existing decoders stay backward-compatible.
|
|
38
|
+
*/ /** Position enriched with market/instrument context returned by /positions. */ /** true when holding > 0 */ /** true = oPRM (outcome position), false = PRM (write/minted) */ /** Flat list sorted by updatedAt desc. */ /** Same positions grouped by market for convenient access. */ // ============================================================================
|
|
35
39
|
// HISTORY TYPES
|
|
36
40
|
// ============================================================================
|
|
37
|
-
/** Net proceeds after fees (profit - fees), as a string */ /** true = ask (maker sells), false = bid (maker buys); from API when available */ /** Recent trade item as returned by getMarketRecentTrades */
|
|
41
|
+
/** Net proceeds after fees (profit - fees), as a string */ /** true = ask (maker sells), false = bid (maker buys); from API when available */ /** Recent trade item as returned by getMarketRecentTrades */ /**
|
|
42
|
+
* All of the above merged and sorted chronologically (newest first).
|
|
43
|
+
* Each event has a `type` discriminator field.
|
|
44
|
+
* Populated by /history — may be absent on sub-routes like /history/mints.
|
|
45
|
+
*/ // ============================================================================
|
|
38
46
|
// DEPTH TYPES
|
|
39
47
|
// ============================================================================
|
|
40
48
|
// Note: DepthLevel is exported from sync/clients/order-client.ts
|
|
@@ -56,15 +56,17 @@ function _object_spread_props(target, source) {
|
|
|
56
56
|
* Note: Most endpoints now return pre-formatted string values,
|
|
57
57
|
* so minimal deserialization is needed. These helpers are provided
|
|
58
58
|
* for cases where BigInt conversion is preferred on the client side.
|
|
59
|
-
*/ function parseOptionalBigInt(value) {
|
|
59
|
+
*/ /** @deprecated Use `instruments` instead. */ function parseOptionalBigInt(value) {
|
|
60
60
|
return value == null ? null : BigInt(value);
|
|
61
61
|
}
|
|
62
62
|
function parseIsCall(value) {
|
|
63
63
|
return value === true || value === 1;
|
|
64
64
|
}
|
|
65
65
|
function submarketToBigInt(submarket) {
|
|
66
|
+
var _submarket_marketId;
|
|
66
67
|
return {
|
|
67
68
|
id: submarket.id,
|
|
69
|
+
marketId: (_submarket_marketId = submarket.marketId) !== null && _submarket_marketId !== void 0 ? _submarket_marketId : submarket.id,
|
|
68
70
|
name: submarket.name,
|
|
69
71
|
tokenAddress: submarket.tokenAddress,
|
|
70
72
|
tokenDecimals: submarket.tokenDecimals,
|
|
@@ -106,6 +108,7 @@ function submarketToBigInt(submarket) {
|
|
|
106
108
|
/**
|
|
107
109
|
* Convert string market fields to BigInt while preserving addresses and labels.
|
|
108
110
|
*/ export function marketToBigInt(market) {
|
|
111
|
+
var _market_logoUri, _market_hasFinalTick;
|
|
109
112
|
var baseMarket = {
|
|
110
113
|
id: market.id,
|
|
111
114
|
groupId: market.groupId,
|
|
@@ -121,14 +124,17 @@ function submarketToBigInt(submarket) {
|
|
|
121
124
|
collateralToken: market.collateralToken,
|
|
122
125
|
collateralDecimals: market.collateralDecimals,
|
|
123
126
|
maxDecimals: parseOptionalBigInt(market.maxDecimals),
|
|
124
|
-
marketType: market.marketType
|
|
127
|
+
marketType: market.marketType,
|
|
128
|
+
logoUri: (_market_logoUri = market.logoUri) !== null && _market_logoUri !== void 0 ? _market_logoUri : null,
|
|
129
|
+
hasFinalTick: (_market_hasFinalTick = market.hasFinalTick) !== null && _market_hasFinalTick !== void 0 ? _market_hasFinalTick : false
|
|
125
130
|
};
|
|
126
131
|
if (market.type === "erc20") {
|
|
132
|
+
var _ref, _market_instruments;
|
|
127
133
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
|
128
134
|
type: "erc20",
|
|
129
135
|
underlying: market.underlying,
|
|
130
136
|
underlyingDecimals: market.underlyingDecimals,
|
|
131
|
-
|
|
137
|
+
instruments: ((_ref = (_market_instruments = market.instruments) !== null && _market_instruments !== void 0 ? _market_instruments : market.submarkets) !== null && _ref !== void 0 ? _ref : []).map(submarketToBigInt)
|
|
132
138
|
});
|
|
133
139
|
}
|
|
134
140
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
|
@@ -698,7 +698,9 @@ function _ts_generator(thisArg, body) {
|
|
|
698
698
|
// USER POSITION & PNL METHODS
|
|
699
699
|
// ============================================================================
|
|
700
700
|
/**
|
|
701
|
-
* Returns
|
|
701
|
+
* Returns enriched user positions including market name, instrument name,
|
|
702
|
+
* logo, collateral info, PnL, and role (isOPrm / isOpen).
|
|
703
|
+
* Also includes a `grouped` array keyed by market.
|
|
702
704
|
*/ function getUserPositions(userAddress) {
|
|
703
705
|
return _async_to_generator(function() {
|
|
704
706
|
return _ts_generator(this, function(_state) {
|
|
@@ -816,8 +818,9 @@ function _ts_generator(thisArg, body) {
|
|
|
816
818
|
// HISTORY METHODS
|
|
817
819
|
// ============================================================================
|
|
818
820
|
/**
|
|
819
|
-
* Returns grouped user history
|
|
820
|
-
*
|
|
821
|
+
* Returns grouped + enriched user history. Every event carries marketName,
|
|
822
|
+
* instrumentName, logoUri, collateralDecimals, collateralToken, and a `type`
|
|
823
|
+
* discriminator. The `timeline` field is a flat chronological list of all events.
|
|
821
824
|
*/ function getUserHistories(userAddress, opts) {
|
|
822
825
|
return _async_to_generator(function() {
|
|
823
826
|
var limit, marketId, tokenId;
|
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@stryke-xyz/premarket-sdk","version":"1.1.
|
|
1
|
+
{"name":"@stryke-xyz/premarket-sdk","version":"1.1.7","type":"module"}
|
package/dist/esm/shared/types.js
CHANGED
|
@@ -15,16 +15,24 @@
|
|
|
15
15
|
OrderStatus["CANCELLED"] = "CANCELLED";
|
|
16
16
|
OrderStatus["EXPIRED"] = "EXPIRED";
|
|
17
17
|
return OrderStatus;
|
|
18
|
-
}({})
|
|
18
|
+
}({})// Enriched by the order-queue when returning user orders
|
|
19
|
+
/** If true, amount is in maker's makingAmount units. If false, amount is in maker's takingAmount units. */ /** The amount to pass to Exchange.fillOrder */ /** Whether fillAmount is in maker's makingAmount units (true) or takingAmount units (false) */ /** True if the user-submitted order's `amount` is in maker's makingAmount units. */ /** Set to "awaiting match" when the engine's match tail did not arrive within the API's wait window. */ // ============================================================================
|
|
19
20
|
// MARKET TYPES
|
|
20
21
|
// ============================================================================
|
|
21
|
-
// ============================================================================
|
|
22
|
+
/** True when the on-chain FinalTick event has been indexed for this market's current expiry. */ /** Numeric market_id of this sub-market (same as id for standalone, member id for grouped). */ /** Sub-markets / instruments in this ERC20 group. */ /** @deprecated Use `instruments` instead. Kept for backward compatibility. */ // ============================================================================
|
|
22
23
|
// POSITION & PNL TYPES
|
|
23
24
|
// ============================================================================
|
|
24
|
-
/** PnL contribution from limit-order trades */ /** PnL contribution from redemption / exercise settlements */
|
|
25
|
+
/** PnL contribution from limit-order trades */ /** PnL contribution from redemption / exercise settlements */ /**
|
|
26
|
+
* Market/instrument metadata the API attaches to positions and history events.
|
|
27
|
+
* All fields are optional so existing decoders stay backward-compatible.
|
|
28
|
+
*/ /** Position enriched with market/instrument context returned by /positions. */ /** true when holding > 0 */ /** true = oPRM (outcome position), false = PRM (write/minted) */ /** Flat list sorted by updatedAt desc. */ /** Same positions grouped by market for convenient access. */ // ============================================================================
|
|
25
29
|
// HISTORY TYPES
|
|
26
30
|
// ============================================================================
|
|
27
|
-
/** Net proceeds after fees (profit - fees), as a string */ /** true = ask (maker sells), false = bid (maker buys); from API when available */ /** Recent trade item as returned by getMarketRecentTrades */
|
|
31
|
+
/** Net proceeds after fees (profit - fees), as a string */ /** true = ask (maker sells), false = bid (maker buys); from API when available */ /** Recent trade item as returned by getMarketRecentTrades */ /**
|
|
32
|
+
* All of the above merged and sorted chronologically (newest first).
|
|
33
|
+
* Each event has a `type` discriminator field.
|
|
34
|
+
* Populated by /history — may be absent on sub-routes like /history/mints.
|
|
35
|
+
*/ // ============================================================================
|
|
28
36
|
// DEPTH TYPES
|
|
29
37
|
// ============================================================================
|
|
30
38
|
// Note: DepthLevel is exported from sync/clients/order-client.ts
|
|
@@ -50,6 +50,8 @@ export interface BigIntBaseMarket {
|
|
|
50
50
|
collateralDecimals: number;
|
|
51
51
|
maxDecimals: bigint | null;
|
|
52
52
|
marketType: "ERC20xERC20" | "ERC20xERC6909";
|
|
53
|
+
logoUri: string | null;
|
|
54
|
+
hasFinalTick: boolean;
|
|
53
55
|
}
|
|
54
56
|
export interface BigIntErc6909Market extends BigIntBaseMarket {
|
|
55
57
|
type: "erc6909";
|
|
@@ -77,6 +79,7 @@ export interface BigIntErc6909Market extends BigIntBaseMarket {
|
|
|
77
79
|
}
|
|
78
80
|
export interface BigIntErc20Submarket {
|
|
79
81
|
id: string;
|
|
82
|
+
marketId: string;
|
|
80
83
|
name: string;
|
|
81
84
|
tokenAddress: string;
|
|
82
85
|
tokenDecimals: number;
|
|
@@ -88,7 +91,9 @@ export interface BigIntErc20Market extends BigIntBaseMarket {
|
|
|
88
91
|
type: "erc20";
|
|
89
92
|
underlying: string | null;
|
|
90
93
|
underlyingDecimals: number | null;
|
|
91
|
-
|
|
94
|
+
instruments: BigIntErc20Submarket[];
|
|
95
|
+
/** @deprecated Use `instruments` instead. */
|
|
96
|
+
submarkets?: BigIntErc20Submarket[];
|
|
92
97
|
}
|
|
93
98
|
export type BigIntMarket = BigIntErc6909Market | BigIntErc20Market;
|
|
94
99
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex } from "viem";
|
|
2
|
-
import type { StoredOrder, CreateOrderParams, CreateOrderResult, MarketsResponse, MarketResponse,
|
|
2
|
+
import type { StoredOrder, CreateOrderParams, CreateOrderResult, MarketsResponse, MarketResponse, TradingPnL, UserPnL, TokenPnL, Erc20PnL, UserHistories, EnrichedPositionsResponse, OrderbookApiConfig, PaginatedOrdersResponse, MarketTradeItem, AuthChallenge } from "../../shared/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Unified HTTP client for orderbook, market, position, and history endpoints.
|
|
5
5
|
*/
|
|
@@ -64,9 +64,11 @@ export declare class OrderbookApi {
|
|
|
64
64
|
*/
|
|
65
65
|
getMarket(marketId: string): Promise<MarketResponse["data"] | null>;
|
|
66
66
|
/**
|
|
67
|
-
* Returns
|
|
67
|
+
* Returns enriched user positions including market name, instrument name,
|
|
68
|
+
* logo, collateral info, PnL, and role (isOPrm / isOpen).
|
|
69
|
+
* Also includes a `grouped` array keyed by market.
|
|
68
70
|
*/
|
|
69
|
-
getUserPositions(userAddress: string): Promise<
|
|
71
|
+
getUserPositions(userAddress: string): Promise<EnrichedPositionsResponse>;
|
|
70
72
|
/**
|
|
71
73
|
* Returns realized trading PnL for limit-order activity.
|
|
72
74
|
*/
|
|
@@ -84,8 +86,9 @@ export declare class OrderbookApi {
|
|
|
84
86
|
*/
|
|
85
87
|
getErc20PnL(userAddress: string, tokenAddress: string): Promise<Erc20PnL>;
|
|
86
88
|
/**
|
|
87
|
-
* Returns grouped user history
|
|
88
|
-
*
|
|
89
|
+
* Returns grouped + enriched user history. Every event carries marketName,
|
|
90
|
+
* instrumentName, logoUri, collateralDecimals, collateralToken, and a `type`
|
|
91
|
+
* discriminator. The `timeline` field is a flat chronological list of all events.
|
|
89
92
|
*/
|
|
90
93
|
getUserHistories(userAddress: string, opts?: {
|
|
91
94
|
limit?: number;
|
|
@@ -61,6 +61,9 @@ export interface StoredOrder {
|
|
|
61
61
|
status: OrderStatus;
|
|
62
62
|
side: "bid" | "ask";
|
|
63
63
|
price: number;
|
|
64
|
+
marketName?: string;
|
|
65
|
+
instrumentName?: string;
|
|
66
|
+
logoUri?: string | null;
|
|
64
67
|
}
|
|
65
68
|
export type MatchableOrder = StoredOrder;
|
|
66
69
|
export interface MatchRequest {
|
|
@@ -137,6 +140,9 @@ export interface BaseMarket {
|
|
|
137
140
|
collateralDecimals: number;
|
|
138
141
|
maxDecimals: string | null;
|
|
139
142
|
marketType: "ERC20xERC20" | "ERC20xERC6909";
|
|
143
|
+
logoUri: string | null;
|
|
144
|
+
/** True when the on-chain FinalTick event has been indexed for this market's current expiry. */
|
|
145
|
+
hasFinalTick: boolean;
|
|
140
146
|
}
|
|
141
147
|
export interface BaseMarketInstrument {
|
|
142
148
|
id: string;
|
|
@@ -168,6 +174,8 @@ export interface SpreadMarketInstrument extends BaseMarketInstrument {
|
|
|
168
174
|
export type MarketInstrument = VanillaMarketInstrument | SpreadMarketInstrument;
|
|
169
175
|
export interface Erc20Submarket {
|
|
170
176
|
id: string;
|
|
177
|
+
/** Numeric market_id of this sub-market (same as id for standalone, member id for grouped). */
|
|
178
|
+
marketId: string;
|
|
171
179
|
name: string;
|
|
172
180
|
tokenAddress: string;
|
|
173
181
|
tokenDecimals: number;
|
|
@@ -204,7 +212,10 @@ export interface Erc20Market extends BaseMarket {
|
|
|
204
212
|
type: "erc20";
|
|
205
213
|
underlying: string | null;
|
|
206
214
|
underlyingDecimals: number | null;
|
|
207
|
-
|
|
215
|
+
/** Sub-markets / instruments in this ERC20 group. */
|
|
216
|
+
instruments: Erc20Submarket[];
|
|
217
|
+
/** @deprecated Use `instruments` instead. Kept for backward compatibility. */
|
|
218
|
+
submarkets?: Erc20Submarket[];
|
|
208
219
|
}
|
|
209
220
|
export type ApiMarket = Erc6909Market | Erc20Market;
|
|
210
221
|
export type Market = ApiMarket;
|
|
@@ -232,6 +243,45 @@ export interface UserPosition {
|
|
|
232
243
|
redeemExercisePnl: string;
|
|
233
244
|
updatedAt: string;
|
|
234
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Market/instrument metadata the API attaches to positions and history events.
|
|
248
|
+
* All fields are optional so existing decoders stay backward-compatible.
|
|
249
|
+
*/
|
|
250
|
+
export interface EventEnrichment {
|
|
251
|
+
collateralSymbol?: string;
|
|
252
|
+
marketId?: string | null;
|
|
253
|
+
marketName?: string;
|
|
254
|
+
instrumentName?: string;
|
|
255
|
+
logoUri?: string | null;
|
|
256
|
+
collateralDecimals?: number;
|
|
257
|
+
collateralToken?: string;
|
|
258
|
+
}
|
|
259
|
+
/** Position enriched with market/instrument context returned by /positions. */
|
|
260
|
+
export interface EnrichedPosition extends UserPosition, EventEnrichment {
|
|
261
|
+
/** true when holding > 0 */
|
|
262
|
+
isOpen: boolean;
|
|
263
|
+
/** true = oPRM (outcome position), false = PRM (write/minted) */
|
|
264
|
+
isOPrm: boolean;
|
|
265
|
+
marketId: string;
|
|
266
|
+
marketName: string;
|
|
267
|
+
instrumentName: string;
|
|
268
|
+
logoUri: string | null;
|
|
269
|
+
collateralDecimals: number;
|
|
270
|
+
collateralToken: string;
|
|
271
|
+
}
|
|
272
|
+
export interface EnrichedPositionsResponse {
|
|
273
|
+
/** Flat list sorted by updatedAt desc. */
|
|
274
|
+
positions: EnrichedPosition[];
|
|
275
|
+
/** Same positions grouped by market for convenient access. */
|
|
276
|
+
grouped: Array<{
|
|
277
|
+
marketId: string;
|
|
278
|
+
marketName: string;
|
|
279
|
+
logoUri: string | null;
|
|
280
|
+
collateralDecimals: number;
|
|
281
|
+
collateralToken: string;
|
|
282
|
+
positions: EnrichedPosition[];
|
|
283
|
+
}>;
|
|
284
|
+
}
|
|
235
285
|
export interface TradingPnL {
|
|
236
286
|
id: string;
|
|
237
287
|
asset: `0x${string}`;
|
|
@@ -274,7 +324,7 @@ export interface Erc20PnL {
|
|
|
274
324
|
trading: TradingPnL | null;
|
|
275
325
|
totalPnl: string;
|
|
276
326
|
}
|
|
277
|
-
export interface MintHistoryItem {
|
|
327
|
+
export interface MintHistoryItem extends EventEnrichment {
|
|
278
328
|
id: string;
|
|
279
329
|
marketId: string;
|
|
280
330
|
prmTokenId: string;
|
|
@@ -289,8 +339,9 @@ export interface MintHistoryItem {
|
|
|
289
339
|
transactionHash: `0x${string}`;
|
|
290
340
|
blockNumber: string;
|
|
291
341
|
timestamp: string;
|
|
342
|
+
type?: "mint";
|
|
292
343
|
}
|
|
293
|
-
export interface RedeemHistoryItem {
|
|
344
|
+
export interface RedeemHistoryItem extends EventEnrichment {
|
|
294
345
|
id: string;
|
|
295
346
|
oPrmTokenId: string;
|
|
296
347
|
prmTokenId: string;
|
|
@@ -304,8 +355,9 @@ export interface RedeemHistoryItem {
|
|
|
304
355
|
transactionHash: `0x${string}`;
|
|
305
356
|
blockNumber: string;
|
|
306
357
|
timestamp: string;
|
|
358
|
+
type?: "redeem";
|
|
307
359
|
}
|
|
308
|
-
export interface UnwindHistoryItem {
|
|
360
|
+
export interface UnwindHistoryItem extends EventEnrichment {
|
|
309
361
|
id: string;
|
|
310
362
|
marketId: string;
|
|
311
363
|
prmTokenId: string;
|
|
@@ -320,8 +372,9 @@ export interface UnwindHistoryItem {
|
|
|
320
372
|
transactionHash: `0x${string}`;
|
|
321
373
|
blockNumber: string;
|
|
322
374
|
timestamp: string;
|
|
375
|
+
type?: "unwind";
|
|
323
376
|
}
|
|
324
|
-
export interface TransferHistoryItem {
|
|
377
|
+
export interface TransferHistoryItem extends EventEnrichment {
|
|
325
378
|
id: string;
|
|
326
379
|
vaultId: string;
|
|
327
380
|
caller: `0x${string}`;
|
|
@@ -333,8 +386,9 @@ export interface TransferHistoryItem {
|
|
|
333
386
|
transactionHash: `0x${string}`;
|
|
334
387
|
blockNumber: string;
|
|
335
388
|
timestamp: string;
|
|
389
|
+
type?: "transfer";
|
|
336
390
|
}
|
|
337
|
-
export interface OrderFillHistoryItem {
|
|
391
|
+
export interface OrderFillHistoryItem extends EventEnrichment {
|
|
338
392
|
id: string;
|
|
339
393
|
orderHash: `0x${string}`;
|
|
340
394
|
maker: `0x${string}`;
|
|
@@ -353,10 +407,11 @@ export interface OrderFillHistoryItem {
|
|
|
353
407
|
timestamp: string;
|
|
354
408
|
/** true = ask (maker sells), false = bid (maker buys); from API when available */
|
|
355
409
|
isAsk?: boolean;
|
|
410
|
+
type?: "fill";
|
|
356
411
|
}
|
|
357
412
|
/** Recent trade item as returned by getMarketRecentTrades */
|
|
358
413
|
export type MarketTradeItem = OrderFillHistoryItem;
|
|
359
|
-
export interface WithdrawHistoryItem {
|
|
414
|
+
export interface WithdrawHistoryItem extends EventEnrichment {
|
|
360
415
|
id: string;
|
|
361
416
|
marketId: string;
|
|
362
417
|
prmTokenId: string;
|
|
@@ -370,8 +425,9 @@ export interface WithdrawHistoryItem {
|
|
|
370
425
|
transactionHash: `0x${string}`;
|
|
371
426
|
blockNumber: string;
|
|
372
427
|
timestamp: string;
|
|
428
|
+
type?: "withdraw";
|
|
373
429
|
}
|
|
374
|
-
export interface RolloverHistoryItem {
|
|
430
|
+
export interface RolloverHistoryItem extends EventEnrichment {
|
|
375
431
|
id: string;
|
|
376
432
|
marketId: string;
|
|
377
433
|
oldMarketId: string | null;
|
|
@@ -390,8 +446,9 @@ export interface RolloverHistoryItem {
|
|
|
390
446
|
transactionHash: `0x${string}`;
|
|
391
447
|
blockNumber: string;
|
|
392
448
|
timestamp: string;
|
|
449
|
+
type?: "rollover";
|
|
393
450
|
}
|
|
394
|
-
export interface OrderCancelHistoryItem {
|
|
451
|
+
export interface OrderCancelHistoryItem extends EventEnrichment {
|
|
395
452
|
id: string;
|
|
396
453
|
marketId: string;
|
|
397
454
|
tokenId: string;
|
|
@@ -400,7 +457,9 @@ export interface OrderCancelHistoryItem {
|
|
|
400
457
|
transactionHash: `0x${string}`;
|
|
401
458
|
blockNumber: string;
|
|
402
459
|
timestamp: string;
|
|
460
|
+
type?: "cancel";
|
|
403
461
|
}
|
|
462
|
+
export type AnyHistoryEvent = MintHistoryItem | RedeemHistoryItem | UnwindHistoryItem | WithdrawHistoryItem | RolloverHistoryItem | TransferHistoryItem | OrderFillHistoryItem | OrderCancelHistoryItem;
|
|
404
463
|
export interface UserHistories {
|
|
405
464
|
mints: MintHistoryItem[];
|
|
406
465
|
redeems: RedeemHistoryItem[];
|
|
@@ -410,6 +469,12 @@ export interface UserHistories {
|
|
|
410
469
|
transfers: TransferHistoryItem[];
|
|
411
470
|
fills: OrderFillHistoryItem[];
|
|
412
471
|
cancels: OrderCancelHistoryItem[];
|
|
472
|
+
/**
|
|
473
|
+
* All of the above merged and sorted chronologically (newest first).
|
|
474
|
+
* Each event has a `type` discriminator field.
|
|
475
|
+
* Populated by /history — may be absent on sub-routes like /history/mints.
|
|
476
|
+
*/
|
|
477
|
+
timeline?: AnyHistoryEvent[];
|
|
413
478
|
}
|
|
414
479
|
export interface PaginatedOrdersResponse {
|
|
415
480
|
orders: StoredOrder[];
|