@stryke-xyz/premarket-sdk 1.1.6 → 1.1.8
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 +10 -3
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/shared/types.js +5 -3
- package/dist/esm/api/orderbook-api/deserializers.js +10 -3
- package/dist/esm/package.json +1 -1
- package/dist/esm/shared/types.js +5 -3
- package/dist/types/api/orderbook-api/deserializers.d.ts +7 -1
- package/dist/types/shared/types.d.ts +20 -1
- 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,9 +150,11 @@ 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_groupName, _market_logoUri, _market_hasFinalTick;
|
|
151
154
|
var baseMarket = {
|
|
152
155
|
id: market.id,
|
|
153
156
|
groupId: market.groupId,
|
|
157
|
+
groupName: (_market_groupName = market.groupName) !== null && _market_groupName !== void 0 ? _market_groupName : null,
|
|
154
158
|
type: market.type,
|
|
155
159
|
name: market.name,
|
|
156
160
|
description: market.description,
|
|
@@ -163,14 +167,17 @@ function submarketToBigInt(submarket) {
|
|
|
163
167
|
collateralToken: market.collateralToken,
|
|
164
168
|
collateralDecimals: market.collateralDecimals,
|
|
165
169
|
maxDecimals: parseOptionalBigInt(market.maxDecimals),
|
|
166
|
-
marketType: market.marketType
|
|
170
|
+
marketType: market.marketType,
|
|
171
|
+
logoUri: (_market_logoUri = market.logoUri) !== null && _market_logoUri !== void 0 ? _market_logoUri : null,
|
|
172
|
+
hasFinalTick: (_market_hasFinalTick = market.hasFinalTick) !== null && _market_hasFinalTick !== void 0 ? _market_hasFinalTick : false
|
|
167
173
|
};
|
|
168
174
|
if (market.type === "erc20") {
|
|
175
|
+
var _ref, _market_instruments;
|
|
169
176
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
|
170
177
|
type: "erc20",
|
|
171
178
|
underlying: market.underlying,
|
|
172
179
|
underlyingDecimals: market.underlyingDecimals,
|
|
173
|
-
|
|
180
|
+
instruments: ((_ref = (_market_instruments = market.instruments) !== null && _market_instruments !== void 0 ? _market_instruments : market.submarkets) !== null && _ref !== void 0 ? _ref : []).map(submarketToBigInt)
|
|
174
181
|
});
|
|
175
182
|
}
|
|
176
183
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
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.8","type":"commonjs"}
|
package/dist/cjs/shared/types.js
CHANGED
|
@@ -25,10 +25,11 @@ Object.defineProperty(exports, "OrderStatus", {
|
|
|
25
25
|
OrderStatus["CANCELLED"] = "CANCELLED";
|
|
26
26
|
OrderStatus["EXPIRED"] = "EXPIRED";
|
|
27
27
|
return OrderStatus;
|
|
28
|
-
}({})/**
|
|
28
|
+
}({})/** Primary wallet address (depositor) — required for ERC1271 smart account maker validation */ // 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
|
+
/** Human-readable group label; only populated for grouped ERC20 markets. */ /** 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
35
|
/** PnL contribution from limit-order trades */ /** PnL contribution from redemption / exercise settlements */ /**
|
|
@@ -37,7 +38,8 @@ Object.defineProperty(exports, "OrderStatus", {
|
|
|
37
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. */ // ============================================================================
|
|
38
39
|
// HISTORY TYPES
|
|
39
40
|
// ============================================================================
|
|
40
|
-
/** 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 */ /** FinalTick of the just-closed (oldExpiry) epoch, if indexed. Null if the
|
|
42
|
+
* settlement event hasn't been indexed yet or for legacy rows. */ /**
|
|
41
43
|
* All of the above merged and sorted chronologically (newest first).
|
|
42
44
|
* Each event has a `type` discriminator field.
|
|
43
45
|
* Populated by /history — may be absent on sub-routes like /history/mints.
|
|
@@ -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,9 +108,11 @@ 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_groupName, _market_logoUri, _market_hasFinalTick;
|
|
109
112
|
var baseMarket = {
|
|
110
113
|
id: market.id,
|
|
111
114
|
groupId: market.groupId,
|
|
115
|
+
groupName: (_market_groupName = market.groupName) !== null && _market_groupName !== void 0 ? _market_groupName : null,
|
|
112
116
|
type: market.type,
|
|
113
117
|
name: market.name,
|
|
114
118
|
description: market.description,
|
|
@@ -121,14 +125,17 @@ function submarketToBigInt(submarket) {
|
|
|
121
125
|
collateralToken: market.collateralToken,
|
|
122
126
|
collateralDecimals: market.collateralDecimals,
|
|
123
127
|
maxDecimals: parseOptionalBigInt(market.maxDecimals),
|
|
124
|
-
marketType: market.marketType
|
|
128
|
+
marketType: market.marketType,
|
|
129
|
+
logoUri: (_market_logoUri = market.logoUri) !== null && _market_logoUri !== void 0 ? _market_logoUri : null,
|
|
130
|
+
hasFinalTick: (_market_hasFinalTick = market.hasFinalTick) !== null && _market_hasFinalTick !== void 0 ? _market_hasFinalTick : false
|
|
125
131
|
};
|
|
126
132
|
if (market.type === "erc20") {
|
|
133
|
+
var _ref, _market_instruments;
|
|
127
134
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
|
128
135
|
type: "erc20",
|
|
129
136
|
underlying: market.underlying,
|
|
130
137
|
underlyingDecimals: market.underlyingDecimals,
|
|
131
|
-
|
|
138
|
+
instruments: ((_ref = (_market_instruments = market.instruments) !== null && _market_instruments !== void 0 ? _market_instruments : market.submarkets) !== null && _ref !== void 0 ? _ref : []).map(submarketToBigInt)
|
|
132
139
|
});
|
|
133
140
|
}
|
|
134
141
|
return _object_spread_props(_object_spread({}, baseMarket), {
|
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.8","type":"module"}
|
package/dist/esm/shared/types.js
CHANGED
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
OrderStatus["CANCELLED"] = "CANCELLED";
|
|
16
16
|
OrderStatus["EXPIRED"] = "EXPIRED";
|
|
17
17
|
return OrderStatus;
|
|
18
|
-
}({})/**
|
|
18
|
+
}({})/** Primary wallet address (depositor) — required for ERC1271 smart account maker validation */ // 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
|
+
/** Human-readable group label; only populated for grouped ERC20 markets. */ /** 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
25
|
/** PnL contribution from limit-order trades */ /** PnL contribution from redemption / exercise settlements */ /**
|
|
@@ -27,7 +28,8 @@
|
|
|
27
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. */ // ============================================================================
|
|
28
29
|
// HISTORY TYPES
|
|
29
30
|
// ============================================================================
|
|
30
|
-
/** 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 */ /** FinalTick of the just-closed (oldExpiry) epoch, if indexed. Null if the
|
|
32
|
+
* settlement event hasn't been indexed yet or for legacy rows. */ /**
|
|
31
33
|
* All of the above merged and sorted chronologically (newest first).
|
|
32
34
|
* Each event has a `type` discriminator field.
|
|
33
35
|
* Populated by /history — may be absent on sub-routes like /history/mints.
|
|
@@ -37,6 +37,7 @@ export type BigIntMarketInstrument = BigIntVanillaMarketInstrument | BigIntSprea
|
|
|
37
37
|
export interface BigIntBaseMarket {
|
|
38
38
|
id: string;
|
|
39
39
|
groupId: string | null;
|
|
40
|
+
groupName: string | null;
|
|
40
41
|
type: "erc6909" | "erc20";
|
|
41
42
|
name: string;
|
|
42
43
|
description: string;
|
|
@@ -50,6 +51,8 @@ export interface BigIntBaseMarket {
|
|
|
50
51
|
collateralDecimals: number;
|
|
51
52
|
maxDecimals: bigint | null;
|
|
52
53
|
marketType: "ERC20xERC20" | "ERC20xERC6909";
|
|
54
|
+
logoUri: string | null;
|
|
55
|
+
hasFinalTick: boolean;
|
|
53
56
|
}
|
|
54
57
|
export interface BigIntErc6909Market extends BigIntBaseMarket {
|
|
55
58
|
type: "erc6909";
|
|
@@ -77,6 +80,7 @@ export interface BigIntErc6909Market extends BigIntBaseMarket {
|
|
|
77
80
|
}
|
|
78
81
|
export interface BigIntErc20Submarket {
|
|
79
82
|
id: string;
|
|
83
|
+
marketId: string;
|
|
80
84
|
name: string;
|
|
81
85
|
tokenAddress: string;
|
|
82
86
|
tokenDecimals: number;
|
|
@@ -88,7 +92,9 @@ export interface BigIntErc20Market extends BigIntBaseMarket {
|
|
|
88
92
|
type: "erc20";
|
|
89
93
|
underlying: string | null;
|
|
90
94
|
underlyingDecimals: number | null;
|
|
91
|
-
|
|
95
|
+
instruments: BigIntErc20Submarket[];
|
|
96
|
+
/** @deprecated Use `instruments` instead. */
|
|
97
|
+
submarkets?: BigIntErc20Submarket[];
|
|
92
98
|
}
|
|
93
99
|
export type BigIntMarket = BigIntErc6909Market | BigIntErc20Market;
|
|
94
100
|
/**
|
|
@@ -45,6 +45,8 @@ export interface CreateOrderParams {
|
|
|
45
45
|
order: Order;
|
|
46
46
|
signature: OrderSignature;
|
|
47
47
|
operator?: string;
|
|
48
|
+
/** Primary wallet address (depositor) — required for ERC1271 smart account maker validation */
|
|
49
|
+
depositor?: string;
|
|
48
50
|
timeInForce?: TimeInForce;
|
|
49
51
|
postOnly?: boolean;
|
|
50
52
|
}
|
|
@@ -61,6 +63,9 @@ export interface StoredOrder {
|
|
|
61
63
|
status: OrderStatus;
|
|
62
64
|
side: "bid" | "ask";
|
|
63
65
|
price: number;
|
|
66
|
+
marketName?: string;
|
|
67
|
+
instrumentName?: string;
|
|
68
|
+
logoUri?: string | null;
|
|
64
69
|
}
|
|
65
70
|
export type MatchableOrder = StoredOrder;
|
|
66
71
|
export interface MatchRequest {
|
|
@@ -124,6 +129,8 @@ export type SpreadType = "vanilla" | "standard" | "absolute";
|
|
|
124
129
|
export interface BaseMarket {
|
|
125
130
|
id: string;
|
|
126
131
|
groupId: string | null;
|
|
132
|
+
/** Human-readable group label; only populated for grouped ERC20 markets. */
|
|
133
|
+
groupName: string | null;
|
|
127
134
|
type: "erc6909" | "erc20";
|
|
128
135
|
name: string;
|
|
129
136
|
description: string;
|
|
@@ -137,6 +144,9 @@ export interface BaseMarket {
|
|
|
137
144
|
collateralDecimals: number;
|
|
138
145
|
maxDecimals: string | null;
|
|
139
146
|
marketType: "ERC20xERC20" | "ERC20xERC6909";
|
|
147
|
+
logoUri: string | null;
|
|
148
|
+
/** True when the on-chain FinalTick event has been indexed for this market's current expiry. */
|
|
149
|
+
hasFinalTick: boolean;
|
|
140
150
|
}
|
|
141
151
|
export interface BaseMarketInstrument {
|
|
142
152
|
id: string;
|
|
@@ -168,6 +178,8 @@ export interface SpreadMarketInstrument extends BaseMarketInstrument {
|
|
|
168
178
|
export type MarketInstrument = VanillaMarketInstrument | SpreadMarketInstrument;
|
|
169
179
|
export interface Erc20Submarket {
|
|
170
180
|
id: string;
|
|
181
|
+
/** Numeric market_id of this sub-market (same as id for standalone, member id for grouped). */
|
|
182
|
+
marketId: string;
|
|
171
183
|
name: string;
|
|
172
184
|
tokenAddress: string;
|
|
173
185
|
tokenDecimals: number;
|
|
@@ -204,7 +216,10 @@ export interface Erc20Market extends BaseMarket {
|
|
|
204
216
|
type: "erc20";
|
|
205
217
|
underlying: string | null;
|
|
206
218
|
underlyingDecimals: number | null;
|
|
207
|
-
|
|
219
|
+
/** Sub-markets / instruments in this ERC20 group. */
|
|
220
|
+
instruments: Erc20Submarket[];
|
|
221
|
+
/** @deprecated Use `instruments` instead. Kept for backward compatibility. */
|
|
222
|
+
submarkets?: Erc20Submarket[];
|
|
208
223
|
}
|
|
209
224
|
export type ApiMarket = Erc6909Market | Erc20Market;
|
|
210
225
|
export type Market = ApiMarket;
|
|
@@ -237,6 +252,7 @@ export interface UserPosition {
|
|
|
237
252
|
* All fields are optional so existing decoders stay backward-compatible.
|
|
238
253
|
*/
|
|
239
254
|
export interface EventEnrichment {
|
|
255
|
+
collateralSymbol?: string;
|
|
240
256
|
marketId?: string | null;
|
|
241
257
|
marketName?: string;
|
|
242
258
|
instrumentName?: string;
|
|
@@ -431,6 +447,9 @@ export interface RolloverHistoryItem extends EventEnrichment {
|
|
|
431
447
|
rolloverFee: string;
|
|
432
448
|
netRolloverCollateral: string;
|
|
433
449
|
newAmount: string;
|
|
450
|
+
/** FinalTick of the just-closed (oldExpiry) epoch, if indexed. Null if the
|
|
451
|
+
* settlement event hasn't been indexed yet or for legacy rows. */
|
|
452
|
+
finalTick: string | null;
|
|
434
453
|
transactionHash: `0x${string}`;
|
|
435
454
|
blockNumber: string;
|
|
436
455
|
timestamp: string;
|