@dimes-dot-fi/sdk 1.0.6 → 1.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/README.md +15 -0
- package/dist/{chunk-XWRROLKW.mjs → chunk-YUCGNELT.mjs} +6 -2
- package/dist/chunk-YUCGNELT.mjs.map +1 -0
- package/dist/{chunk-MSD7A3XX.cjs → chunk-ZK56XS4X.cjs} +6 -2
- package/dist/chunk-ZK56XS4X.cjs.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types-B7_dC7HC.d.ts +42 -0
- package/dist/types-C9X_jp99.d.cts +42 -0
- package/dist/ws/index.cjs +22 -4
- package/dist/ws/index.cjs.map +1 -1
- package/dist/ws/index.d.cts +6 -3
- package/dist/ws/index.d.ts +6 -3
- package/dist/ws/index.mjs +19 -1
- package/dist/ws/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-MSD7A3XX.cjs.map +0 -1
- package/dist/chunk-XWRROLKW.mjs.map +0 -1
- package/dist/types-C2WfUBLu.d.cts +0 -18
- package/dist/types-oz2d_Nyk.d.ts +0 -18
package/README.md
CHANGED
|
@@ -231,6 +231,21 @@ Same API, same contracts, fake USDC. Get a sandbox key via the [Telegram link on
|
|
|
231
231
|
- [**On-Chain Integration**](https://docs.dimes.fi/for-developers/on-chain-integration) — wallet patterns and contract ABIs
|
|
232
232
|
- [**UI Guidelines**](https://docs.dimes.fi/for-developers/ui-guidelines) — leverage sliders, quote flow, position cards
|
|
233
233
|
|
|
234
|
+
## Publishing
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Bump version
|
|
238
|
+
pnpm version patch # or minor/major
|
|
239
|
+
|
|
240
|
+
# Publish (pass the auth token inline to bypass 2FA requirement)
|
|
241
|
+
npm publish --access public --registry https://registry.npmjs.org/ --//registry.npmjs.org/:_authToken=npm_XXXX
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Then update the UI:
|
|
245
|
+
```bash
|
|
246
|
+
cd ~/bl/dimes-ui && pnpm add @dimes-dot-fi/sdk@<version>
|
|
247
|
+
```
|
|
248
|
+
|
|
234
249
|
## License
|
|
235
250
|
|
|
236
251
|
MIT
|
|
@@ -11,8 +11,12 @@ var positionEventTypes = [
|
|
|
11
11
|
"position.reverted",
|
|
12
12
|
"position.settled"
|
|
13
13
|
];
|
|
14
|
+
var notificationCodes = {
|
|
15
|
+
orderFulfillmentRetrying: "ORDER_FULFILLMENT_RETRYING"
|
|
16
|
+
};
|
|
14
17
|
|
|
15
18
|
export {
|
|
16
|
-
positionEventTypes
|
|
19
|
+
positionEventTypes,
|
|
20
|
+
notificationCodes
|
|
17
21
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
22
|
+
//# sourceMappingURL=chunk-YUCGNELT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ws/types.ts"],"sourcesContent":["import type { Position } from \"../types\";\n\nexport const positionEventTypes = [\n \"position.cancelled\",\n \"position.close_requested\",\n \"position.closed\",\n \"position.created\",\n \"position.force_unwound\",\n \"position.liquidated\",\n \"position.opened\",\n \"position.opening\",\n \"position.reverted\",\n \"position.settled\",\n] as const;\n\nexport type PositionEventType = (typeof positionEventTypes)[number];\n\nexport interface PositionEventEnvelope {\n id: string;\n type: PositionEventType;\n created_at: string;\n data: Record<string, unknown>;\n}\n\nexport interface PositionEvent {\n id: string;\n type: PositionEventType;\n createdAt: string;\n data: Position;\n}\n\nexport interface NotificationEventEnvelope {\n id: string;\n type: \"notification\";\n created_at: string;\n data: {\n code: string;\n message: string;\n params?: Record<string, unknown>;\n };\n}\n\nexport interface NotificationEvent {\n id: string;\n type: \"notification\";\n createdAt: string;\n data: {\n code: string;\n message: string;\n params?: Record<string, unknown>;\n };\n}\n\nexport const notificationCodes = {\n orderFulfillmentRetrying: \"ORDER_FULFILLMENT_RETRYING\",\n} as const;\n\nexport type NotificationCode = (typeof notificationCodes)[keyof typeof notificationCodes];\n"],"mappings":";AAEO,IAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAwCO,IAAM,oBAAoB;AAAA,EAC/B,0BAA0B;AAC5B;","names":[]}
|
|
@@ -11,8 +11,12 @@ var positionEventTypes = [
|
|
|
11
11
|
"position.reverted",
|
|
12
12
|
"position.settled"
|
|
13
13
|
];
|
|
14
|
+
var notificationCodes = {
|
|
15
|
+
orderFulfillmentRetrying: "ORDER_FULFILLMENT_RETRYING"
|
|
16
|
+
};
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
|
|
21
|
+
exports.positionEventTypes = positionEventTypes; exports.notificationCodes = notificationCodes;
|
|
22
|
+
//# sourceMappingURL=chunk-ZK56XS4X.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/alexemery/bl/dimes-sdk/dist/chunk-ZK56XS4X.cjs","../src/ws/types.ts"],"names":[],"mappings":"AAAA;ACEO,IAAM,mBAAA,EAAqB;AAAA,EAChC,oBAAA;AAAA,EACA,0BAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,wBAAA;AAAA,EACA,qBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAAA;AAwCO,IAAM,kBAAA,EAAoB;AAAA,EAC/B,wBAAA,EAA0B;AAC5B,CAAA;ADvCA;AACA;AACE;AACA;AACF,+FAAC","file":"/Users/alexemery/bl/dimes-sdk/dist/chunk-ZK56XS4X.cjs","sourcesContent":[null,"import type { Position } from \"../types\";\n\nexport const positionEventTypes = [\n \"position.cancelled\",\n \"position.close_requested\",\n \"position.closed\",\n \"position.created\",\n \"position.force_unwound\",\n \"position.liquidated\",\n \"position.opened\",\n \"position.opening\",\n \"position.reverted\",\n \"position.settled\",\n] as const;\n\nexport type PositionEventType = (typeof positionEventTypes)[number];\n\nexport interface PositionEventEnvelope {\n id: string;\n type: PositionEventType;\n created_at: string;\n data: Record<string, unknown>;\n}\n\nexport interface PositionEvent {\n id: string;\n type: PositionEventType;\n createdAt: string;\n data: Position;\n}\n\nexport interface NotificationEventEnvelope {\n id: string;\n type: \"notification\";\n created_at: string;\n data: {\n code: string;\n message: string;\n params?: Record<string, unknown>;\n };\n}\n\nexport interface NotificationEvent {\n id: string;\n type: \"notification\";\n createdAt: string;\n data: {\n code: string;\n message: string;\n params?: Record<string, unknown>;\n };\n}\n\nexport const notificationCodes = {\n orderFulfillmentRetrying: \"ORDER_FULFILLMENT_RETRYING\",\n} as const;\n\nexport type NotificationCode = (typeof notificationCodes)[keyof typeof notificationCodes];\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ var _chunkJWAPH4GDcjs = require('./chunk-JWAPH4GD.cjs');
|
|
|
14
14
|
var _chunkUUE4HG2Hcjs = require('./chunk-UUE4HG2H.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkZK56XS4Xcjs = require('./chunk-ZK56XS4X.cjs');
|
|
18
18
|
|
|
19
19
|
// src/client/dimes-client.ts
|
|
20
20
|
var _humps = require('humps');
|
|
@@ -308,5 +308,5 @@ function leverageMaxBps(lev, side) {
|
|
|
308
308
|
|
|
309
309
|
|
|
310
310
|
|
|
311
|
-
exports.ApiKeyAuth = ApiKeyAuth; exports.DimesApiError = _chunkUUE4HG2Hcjs.DimesApiError; exports.DimesClient = DimesClient; exports.DimesContractError = _chunkUUE4HG2Hcjs.DimesContractError; exports.DimesError = _chunkUUE4HG2Hcjs.DimesError; exports.JwtAuth = JwtAuth; exports.buildQuoteParams = _chunkJWAPH4GDcjs.buildQuoteParams; exports.executeQuote = _chunkJWAPH4GDcjs.executeQuote; exports.formatErrorMessage = _chunkUUE4HG2Hcjs.formatErrorMessage; exports.hintAdjustment = _chunkJWAPH4GDcjs.hintAdjustment; exports.isClosedPosition = isClosedPosition; exports.isOpenPosition = isOpenPosition; exports.leverageMaxBps = leverageMaxBps; exports.marketMovedCodes = _chunkJWAPH4GDcjs.marketMovedCodes; exports.positionEventTypes =
|
|
311
|
+
exports.ApiKeyAuth = ApiKeyAuth; exports.DimesApiError = _chunkUUE4HG2Hcjs.DimesApiError; exports.DimesClient = DimesClient; exports.DimesContractError = _chunkUUE4HG2Hcjs.DimesContractError; exports.DimesError = _chunkUUE4HG2Hcjs.DimesError; exports.JwtAuth = JwtAuth; exports.buildQuoteParams = _chunkJWAPH4GDcjs.buildQuoteParams; exports.executeQuote = _chunkJWAPH4GDcjs.executeQuote; exports.formatErrorMessage = _chunkUUE4HG2Hcjs.formatErrorMessage; exports.hintAdjustment = _chunkJWAPH4GDcjs.hintAdjustment; exports.isClosedPosition = isClosedPosition; exports.isOpenPosition = isOpenPosition; exports.leverageMaxBps = leverageMaxBps; exports.marketMovedCodes = _chunkJWAPH4GDcjs.marketMovedCodes; exports.positionEventTypes = _chunkZK56XS4Xcjs.positionEventTypes; exports.quoteErrorHint = _chunkJWAPH4GDcjs.quoteErrorHint; exports.resolveFriendlyMessage = _chunkUUE4HG2Hcjs.resolveFriendlyMessage;
|
|
312
312
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { C as CreateOfferParams, O as Offer } from './aliases-CXfmUrAb.cjs';
|
|
|
4
4
|
export { a as CamelizeKeys, b as ClosedPosition, c as ContractInfo, d as CreateTokenResult, e as CustomerLimit, M as Market, f as MarketFees, g as MarketLeverage, h as MarketPrices, i as OpenPosition, j as OriginationTier, P as Position, k as PositionClosedFees, l as PositionCurrent, m as PositionEntry, n as PositionFailure, o as PositionOpenFees, p as PositionResult, q as PositionRisk, r as PositionTiming, s as PositionUnwind, t as PositionUnwindList, u as isClosedPosition, v as isOpenPosition, w as leverageMaxBps } from './aliases-CXfmUrAb.cjs';
|
|
5
5
|
import { Q as QuoteParams, a as QuoteOptions, b as QuoteResult } from './quote-DqF3MEbh.cjs';
|
|
6
6
|
export { M as MarketMovedEvent, S as Side } from './quote-DqF3MEbh.cjs';
|
|
7
|
-
export { P as PositionEvent, a as PositionEventType, p as positionEventTypes } from './types-
|
|
7
|
+
export { P as PositionEvent, a as PositionEventType, p as positionEventTypes } from './types-C9X_jp99.cjs';
|
|
8
8
|
|
|
9
9
|
type Params = Record<string, unknown> | null;
|
|
10
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { C as CreateOfferParams, O as Offer } from './aliases-CXfmUrAb.js';
|
|
|
4
4
|
export { a as CamelizeKeys, b as ClosedPosition, c as ContractInfo, d as CreateTokenResult, e as CustomerLimit, M as Market, f as MarketFees, g as MarketLeverage, h as MarketPrices, i as OpenPosition, j as OriginationTier, P as Position, k as PositionClosedFees, l as PositionCurrent, m as PositionEntry, n as PositionFailure, o as PositionOpenFees, p as PositionResult, q as PositionRisk, r as PositionTiming, s as PositionUnwind, t as PositionUnwindList, u as isClosedPosition, v as isOpenPosition, w as leverageMaxBps } from './aliases-CXfmUrAb.js';
|
|
5
5
|
import { Q as QuoteParams, a as QuoteOptions, b as QuoteResult } from './quote-BB2YieGk.js';
|
|
6
6
|
export { M as MarketMovedEvent, S as Side } from './quote-BB2YieGk.js';
|
|
7
|
-
export { P as PositionEvent, a as PositionEventType, p as positionEventTypes } from './types-
|
|
7
|
+
export { P as PositionEvent, a as PositionEventType, p as positionEventTypes } from './types-B7_dC7HC.js';
|
|
8
8
|
|
|
9
9
|
type Params = Record<string, unknown> | null;
|
|
10
10
|
|
package/dist/index.mjs
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { P as Position } from './aliases-CXfmUrAb.js';
|
|
2
|
+
|
|
3
|
+
declare const positionEventTypes: readonly ["position.cancelled", "position.close_requested", "position.closed", "position.created", "position.force_unwound", "position.liquidated", "position.opened", "position.opening", "position.reverted", "position.settled"];
|
|
4
|
+
type PositionEventType = (typeof positionEventTypes)[number];
|
|
5
|
+
interface PositionEventEnvelope {
|
|
6
|
+
id: string;
|
|
7
|
+
type: PositionEventType;
|
|
8
|
+
created_at: string;
|
|
9
|
+
data: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
interface PositionEvent {
|
|
12
|
+
id: string;
|
|
13
|
+
type: PositionEventType;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
data: Position;
|
|
16
|
+
}
|
|
17
|
+
interface NotificationEventEnvelope {
|
|
18
|
+
id: string;
|
|
19
|
+
type: "notification";
|
|
20
|
+
created_at: string;
|
|
21
|
+
data: {
|
|
22
|
+
code: string;
|
|
23
|
+
message: string;
|
|
24
|
+
params?: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface NotificationEvent {
|
|
28
|
+
id: string;
|
|
29
|
+
type: "notification";
|
|
30
|
+
createdAt: string;
|
|
31
|
+
data: {
|
|
32
|
+
code: string;
|
|
33
|
+
message: string;
|
|
34
|
+
params?: Record<string, unknown>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
declare const notificationCodes: {
|
|
38
|
+
readonly orderFulfillmentRetrying: "ORDER_FULFILLMENT_RETRYING";
|
|
39
|
+
};
|
|
40
|
+
type NotificationCode = (typeof notificationCodes)[keyof typeof notificationCodes];
|
|
41
|
+
|
|
42
|
+
export { type NotificationEvent as N, type PositionEvent as P, type PositionEventType as a, type NotificationCode as b, type NotificationEventEnvelope as c, type PositionEventEnvelope as d, notificationCodes as n, positionEventTypes as p };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { P as Position } from './aliases-CXfmUrAb.cjs';
|
|
2
|
+
|
|
3
|
+
declare const positionEventTypes: readonly ["position.cancelled", "position.close_requested", "position.closed", "position.created", "position.force_unwound", "position.liquidated", "position.opened", "position.opening", "position.reverted", "position.settled"];
|
|
4
|
+
type PositionEventType = (typeof positionEventTypes)[number];
|
|
5
|
+
interface PositionEventEnvelope {
|
|
6
|
+
id: string;
|
|
7
|
+
type: PositionEventType;
|
|
8
|
+
created_at: string;
|
|
9
|
+
data: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
interface PositionEvent {
|
|
12
|
+
id: string;
|
|
13
|
+
type: PositionEventType;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
data: Position;
|
|
16
|
+
}
|
|
17
|
+
interface NotificationEventEnvelope {
|
|
18
|
+
id: string;
|
|
19
|
+
type: "notification";
|
|
20
|
+
created_at: string;
|
|
21
|
+
data: {
|
|
22
|
+
code: string;
|
|
23
|
+
message: string;
|
|
24
|
+
params?: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface NotificationEvent {
|
|
28
|
+
id: string;
|
|
29
|
+
type: "notification";
|
|
30
|
+
createdAt: string;
|
|
31
|
+
data: {
|
|
32
|
+
code: string;
|
|
33
|
+
message: string;
|
|
34
|
+
params?: Record<string, unknown>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
declare const notificationCodes: {
|
|
38
|
+
readonly orderFulfillmentRetrying: "ORDER_FULFILLMENT_RETRYING";
|
|
39
|
+
};
|
|
40
|
+
type NotificationCode = (typeof notificationCodes)[keyof typeof notificationCodes];
|
|
41
|
+
|
|
42
|
+
export { type NotificationEvent as N, type PositionEvent as P, type PositionEventType as a, type NotificationCode as b, type NotificationEventEnvelope as c, type PositionEventEnvelope as d, notificationCodes as n, positionEventTypes as p };
|
package/dist/ws/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkZK56XS4Xcjs = require('../chunk-ZK56XS4X.cjs');
|
|
4
5
|
|
|
5
6
|
// src/ws/position-socket.ts
|
|
6
7
|
var _humps = require('humps');
|
|
@@ -22,7 +23,8 @@ var PositionSocket = (_class = class {
|
|
|
22
23
|
__init3() {this.connectListeners = /* @__PURE__ */ new Set()}
|
|
23
24
|
__init4() {this.disconnectListeners = /* @__PURE__ */ new Set()}
|
|
24
25
|
__init5() {this.errorListeners = /* @__PURE__ */ new Set()}
|
|
25
|
-
|
|
26
|
+
__init6() {this.notificationListeners = /* @__PURE__ */ new Set()}
|
|
27
|
+
constructor(options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);
|
|
26
28
|
this.baseUrl = _nullishCoalesce(options.baseUrl, () => ( "https://api.dimes.fi"));
|
|
27
29
|
this.getToken = options.getToken;
|
|
28
30
|
}
|
|
@@ -61,13 +63,24 @@ var PositionSocket = (_class = class {
|
|
|
61
63
|
cb(err);
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
|
-
for (const eventType of
|
|
66
|
+
for (const eventType of _chunkZK56XS4Xcjs.positionEventTypes) {
|
|
65
67
|
this.socket.on(eventType, (envelope) => {
|
|
66
68
|
const event = camelizeEnvelope(envelope);
|
|
67
69
|
this.emit(eventType, event);
|
|
68
70
|
this.emit("*", event);
|
|
69
71
|
});
|
|
70
72
|
}
|
|
73
|
+
this.socket.on("notification", (envelope) => {
|
|
74
|
+
const event = {
|
|
75
|
+
id: envelope.id,
|
|
76
|
+
type: "notification",
|
|
77
|
+
createdAt: envelope.created_at,
|
|
78
|
+
data: envelope.data
|
|
79
|
+
};
|
|
80
|
+
for (const cb of this.notificationListeners) {
|
|
81
|
+
cb(event);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
71
84
|
}
|
|
72
85
|
disconnect() {
|
|
73
86
|
_optionalChain([this, 'access', _8 => _8.socket, 'optionalAccess', _9 => _9.disconnect, 'call', _10 => _10()]);
|
|
@@ -98,6 +111,10 @@ var PositionSocket = (_class = class {
|
|
|
98
111
|
this.errorListeners.add(cb);
|
|
99
112
|
return () => this.errorListeners.delete(cb);
|
|
100
113
|
}
|
|
114
|
+
onNotification(cb) {
|
|
115
|
+
this.notificationListeners.add(cb);
|
|
116
|
+
return () => this.notificationListeners.delete(cb);
|
|
117
|
+
}
|
|
101
118
|
emit(event, data) {
|
|
102
119
|
const set = this.eventListeners.get(event);
|
|
103
120
|
if (!set) {
|
|
@@ -111,5 +128,6 @@ var PositionSocket = (_class = class {
|
|
|
111
128
|
|
|
112
129
|
|
|
113
130
|
|
|
114
|
-
|
|
131
|
+
|
|
132
|
+
exports.PositionSocket = PositionSocket; exports.notificationCodes = _chunkZK56XS4Xcjs.notificationCodes; exports.positionEventTypes = _chunkZK56XS4Xcjs.positionEventTypes;
|
|
115
133
|
//# sourceMappingURL=index.cjs.map
|
package/dist/ws/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/alexemery/bl/dimes-sdk/dist/ws/index.cjs","../../src/ws/position-socket.ts"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACA;
|
|
1
|
+
{"version":3,"sources":["/Users/alexemery/bl/dimes-sdk/dist/ws/index.cjs","../../src/ws/position-socket.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,yDAA8B;AAC9B;AACA;ACLA,8BAA6B;AAC7B,kDAAgC;AAqBhC,IAAM,YAAA,EAAc,8CAAA;AAE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MAAM,SAAA,EAAW,IAAA,CAAK,QAAA;AACtB,IAAA,IAAA,CAAK,OAAA,EAAS,gCAAA,CAAG,EAAA;AACD,MAAA;AACD,MAAA;AACC,MAAA;AACd,MAAA;AACA,MAAA;AACD,IAAA;AAEc,IAAA;AACF,MAAA;AACN,QAAA;AACL,MAAA;AACD,IAAA;AAEc,IAAA;AACF,MAAA;AACN,QAAA;AACL,MAAA;AACD,IAAA;AAEc,IAAA;AACF,MAAA;AACH,QAAA;AACR,MAAA;AACD,IAAA;AAEU,IAAA;AACM,MAAA;AACC,QAAA;AACJ,QAAA;AACA,QAAA;AACX,MAAA;AACH,IAAA;AAEe,IAAA;AACoB,MAAA;AAClB,QAAA;AACP,QAAA;AACK,QAAA;AACL,QAAA;AACR,MAAA;AACW,MAAA;AACD,QAAA;AACV,MAAA;AACD,IAAA;AACH,EAAA;AAE0B,EAAA;AACX,oBAAA;AACC,IAAA;AAChB,EAAA;AAEO,EAAA;AACW,IAAA;AACH,IAAA;AACf,EAAA;AAEyE,EAAA;AACxD,IAAA;AACL,IAAA;AACF,MAAA;AACD,MAAA;AACP,IAAA;AACU,IAAA;AACO,IAAA;AACnB,EAAA;AAEqD,EAAA;AAC9C,IAAA;AACa,IAAA;AACpB,EAAA;AAEwD,EAAA;AACjD,IAAA;AACa,IAAA;AACpB,EAAA;AAE8C,EAAA;AACvC,IAAA;AACa,IAAA;AACpB,EAAA;AAE4D,EAAA;AACrD,IAAA;AACa,IAAA;AACpB,EAAA;AAEuD,EAAA;AACpC,IAAA;AACP,IAAA;AACR,MAAA;AACF,IAAA;AACiB,IAAA;AACR,MAAA;AACT,IAAA;AACF,EAAA;AACF;ADzCsB;AACA;AACA;AACA;AACA","file":"/Users/alexemery/bl/dimes-sdk/dist/ws/index.cjs","sourcesContent":[null,"import { camelizeKeys } from \"humps\";\nimport { io, type Socket } from \"socket.io-client\";\nimport type { Position } from \"../types\";\nimport {\n positionEventTypes,\n type NotificationEvent,\n type NotificationEventEnvelope,\n type PositionEvent,\n type PositionEventEnvelope,\n type PositionEventType,\n} from \"./types\";\n\nexport interface PositionSocketOptions {\n baseUrl?: string;\n getToken: () => string | null;\n}\n\ntype EventCallback = (event: PositionEvent) => void;\ntype NotificationCallback = (event: NotificationEvent) => void;\ntype ConnectionCallback = () => void;\ntype ErrorCallback = (error: unknown) => void;\n\nconst wsNamespace = \"/v1/ws/prediction-markets/customer-positions\";\n\nfunction camelizeEnvelope(envelope: PositionEventEnvelope): PositionEvent {\n return {\n id: envelope.id,\n type: envelope.type,\n createdAt: envelope.created_at,\n data: camelizeKeys(envelope.data) as unknown as Position,\n };\n}\n\nexport class PositionSocket {\n private socket: Socket | null = null;\n\n private readonly baseUrl: string;\n\n private readonly getToken: () => string | null;\n\n private readonly eventListeners = new Map<string, Set<EventCallback>>();\n\n private readonly connectListeners = new Set<ConnectionCallback>();\n\n private readonly disconnectListeners = new Set<ConnectionCallback>();\n\n private readonly errorListeners = new Set<ErrorCallback>();\n\n private readonly notificationListeners = new Set<NotificationCallback>();\n\n constructor(options: PositionSocketOptions) {\n this.baseUrl = options.baseUrl ?? \"https://api.dimes.fi\";\n this.getToken = options.getToken;\n }\n\n public get connected(): boolean {\n return this.socket?.connected ?? false;\n }\n\n public connect(): void {\n if (this.socket?.connected) {\n return;\n }\n\n this.socket?.disconnect();\n\n const token = this.getToken();\n if (!token) {\n return;\n }\n\n const getToken = this.getToken;\n this.socket = io(`${this.baseUrl}${wsNamespace}`, {\n auth: (cb) => cb({ token: getToken() }),\n transports: [\"websocket\"],\n reconnection: true,\n reconnectionDelay: 1000,\n reconnectionDelayMax: 30000,\n });\n\n this.socket.on(\"connect\", () => {\n for (const cb of this.connectListeners) {\n cb();\n }\n });\n\n this.socket.on(\"disconnect\", () => {\n for (const cb of this.disconnectListeners) {\n cb();\n }\n });\n\n this.socket.on(\"error\", (err: unknown) => {\n for (const cb of this.errorListeners) {\n cb(err);\n }\n });\n\n for (const eventType of positionEventTypes) {\n this.socket.on(eventType, (envelope: PositionEventEnvelope) => {\n const event = camelizeEnvelope(envelope);\n this.emit(eventType, event);\n this.emit(\"*\", event);\n });\n }\n\n this.socket.on(\"notification\", (envelope: NotificationEventEnvelope) => {\n const event: NotificationEvent = {\n id: envelope.id,\n type: \"notification\",\n createdAt: envelope.created_at,\n data: envelope.data,\n };\n for (const cb of this.notificationListeners) {\n cb(event);\n }\n });\n }\n\n public disconnect(): void {\n this.socket?.disconnect();\n this.socket = null;\n }\n\n public reconnectWithToken(): void {\n this.disconnect();\n this.connect();\n }\n\n public on(event: PositionEventType | \"*\", cb: EventCallback): () => void {\n let set = this.eventListeners.get(event);\n if (!set) {\n set = new Set();\n this.eventListeners.set(event, set);\n }\n set.add(cb);\n return () => set.delete(cb);\n }\n\n public onConnect(cb: ConnectionCallback): () => void {\n this.connectListeners.add(cb);\n return () => this.connectListeners.delete(cb);\n }\n\n public onDisconnect(cb: ConnectionCallback): () => void {\n this.disconnectListeners.add(cb);\n return () => this.disconnectListeners.delete(cb);\n }\n\n public onError(cb: ErrorCallback): () => void {\n this.errorListeners.add(cb);\n return () => this.errorListeners.delete(cb);\n }\n\n public onNotification(cb: NotificationCallback): () => void {\n this.notificationListeners.add(cb);\n return () => this.notificationListeners.delete(cb);\n }\n\n private emit(event: string, data: PositionEvent): void {\n const set = this.eventListeners.get(event);\n if (!set) {\n return;\n }\n for (const cb of set) {\n cb(data);\n }\n }\n}\n"]}
|
package/dist/ws/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as PositionEventType, P as PositionEvent } from '../types-
|
|
2
|
-
export { b as PositionEventEnvelope, p as positionEventTypes } from '../types-
|
|
1
|
+
import { a as PositionEventType, P as PositionEvent, N as NotificationEvent } from '../types-C9X_jp99.cjs';
|
|
2
|
+
export { b as NotificationCode, c as NotificationEventEnvelope, d as PositionEventEnvelope, n as notificationCodes, p as positionEventTypes } from '../types-C9X_jp99.cjs';
|
|
3
3
|
import '../aliases-CXfmUrAb.cjs';
|
|
4
4
|
|
|
5
5
|
interface PositionSocketOptions {
|
|
@@ -7,6 +7,7 @@ interface PositionSocketOptions {
|
|
|
7
7
|
getToken: () => string | null;
|
|
8
8
|
}
|
|
9
9
|
type EventCallback = (event: PositionEvent) => void;
|
|
10
|
+
type NotificationCallback = (event: NotificationEvent) => void;
|
|
10
11
|
type ConnectionCallback = () => void;
|
|
11
12
|
type ErrorCallback = (error: unknown) => void;
|
|
12
13
|
declare class PositionSocket {
|
|
@@ -17,6 +18,7 @@ declare class PositionSocket {
|
|
|
17
18
|
private readonly connectListeners;
|
|
18
19
|
private readonly disconnectListeners;
|
|
19
20
|
private readonly errorListeners;
|
|
21
|
+
private readonly notificationListeners;
|
|
20
22
|
constructor(options: PositionSocketOptions);
|
|
21
23
|
get connected(): boolean;
|
|
22
24
|
connect(): void;
|
|
@@ -26,7 +28,8 @@ declare class PositionSocket {
|
|
|
26
28
|
onConnect(cb: ConnectionCallback): () => void;
|
|
27
29
|
onDisconnect(cb: ConnectionCallback): () => void;
|
|
28
30
|
onError(cb: ErrorCallback): () => void;
|
|
31
|
+
onNotification(cb: NotificationCallback): () => void;
|
|
29
32
|
private emit;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
export { PositionEvent, PositionEventType, PositionSocket, type PositionSocketOptions };
|
|
35
|
+
export { NotificationEvent, PositionEvent, PositionEventType, PositionSocket, type PositionSocketOptions };
|
package/dist/ws/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as PositionEventType, P as PositionEvent } from '../types-
|
|
2
|
-
export { b as PositionEventEnvelope, p as positionEventTypes } from '../types-
|
|
1
|
+
import { a as PositionEventType, P as PositionEvent, N as NotificationEvent } from '../types-B7_dC7HC.js';
|
|
2
|
+
export { b as NotificationCode, c as NotificationEventEnvelope, d as PositionEventEnvelope, n as notificationCodes, p as positionEventTypes } from '../types-B7_dC7HC.js';
|
|
3
3
|
import '../aliases-CXfmUrAb.js';
|
|
4
4
|
|
|
5
5
|
interface PositionSocketOptions {
|
|
@@ -7,6 +7,7 @@ interface PositionSocketOptions {
|
|
|
7
7
|
getToken: () => string | null;
|
|
8
8
|
}
|
|
9
9
|
type EventCallback = (event: PositionEvent) => void;
|
|
10
|
+
type NotificationCallback = (event: NotificationEvent) => void;
|
|
10
11
|
type ConnectionCallback = () => void;
|
|
11
12
|
type ErrorCallback = (error: unknown) => void;
|
|
12
13
|
declare class PositionSocket {
|
|
@@ -17,6 +18,7 @@ declare class PositionSocket {
|
|
|
17
18
|
private readonly connectListeners;
|
|
18
19
|
private readonly disconnectListeners;
|
|
19
20
|
private readonly errorListeners;
|
|
21
|
+
private readonly notificationListeners;
|
|
20
22
|
constructor(options: PositionSocketOptions);
|
|
21
23
|
get connected(): boolean;
|
|
22
24
|
connect(): void;
|
|
@@ -26,7 +28,8 @@ declare class PositionSocket {
|
|
|
26
28
|
onConnect(cb: ConnectionCallback): () => void;
|
|
27
29
|
onDisconnect(cb: ConnectionCallback): () => void;
|
|
28
30
|
onError(cb: ErrorCallback): () => void;
|
|
31
|
+
onNotification(cb: NotificationCallback): () => void;
|
|
29
32
|
private emit;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
export { PositionEvent, PositionEventType, PositionSocket, type PositionSocketOptions };
|
|
35
|
+
export { NotificationEvent, PositionEvent, PositionEventType, PositionSocket, type PositionSocketOptions };
|
package/dist/ws/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
notificationCodes,
|
|
2
3
|
positionEventTypes
|
|
3
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YUCGNELT.mjs";
|
|
4
5
|
|
|
5
6
|
// src/ws/position-socket.ts
|
|
6
7
|
import { camelizeKeys } from "humps";
|
|
@@ -22,6 +23,7 @@ var PositionSocket = class {
|
|
|
22
23
|
connectListeners = /* @__PURE__ */ new Set();
|
|
23
24
|
disconnectListeners = /* @__PURE__ */ new Set();
|
|
24
25
|
errorListeners = /* @__PURE__ */ new Set();
|
|
26
|
+
notificationListeners = /* @__PURE__ */ new Set();
|
|
25
27
|
constructor(options) {
|
|
26
28
|
this.baseUrl = options.baseUrl ?? "https://api.dimes.fi";
|
|
27
29
|
this.getToken = options.getToken;
|
|
@@ -68,6 +70,17 @@ var PositionSocket = class {
|
|
|
68
70
|
this.emit("*", event);
|
|
69
71
|
});
|
|
70
72
|
}
|
|
73
|
+
this.socket.on("notification", (envelope) => {
|
|
74
|
+
const event = {
|
|
75
|
+
id: envelope.id,
|
|
76
|
+
type: "notification",
|
|
77
|
+
createdAt: envelope.created_at,
|
|
78
|
+
data: envelope.data
|
|
79
|
+
};
|
|
80
|
+
for (const cb of this.notificationListeners) {
|
|
81
|
+
cb(event);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
71
84
|
}
|
|
72
85
|
disconnect() {
|
|
73
86
|
this.socket?.disconnect();
|
|
@@ -98,6 +111,10 @@ var PositionSocket = class {
|
|
|
98
111
|
this.errorListeners.add(cb);
|
|
99
112
|
return () => this.errorListeners.delete(cb);
|
|
100
113
|
}
|
|
114
|
+
onNotification(cb) {
|
|
115
|
+
this.notificationListeners.add(cb);
|
|
116
|
+
return () => this.notificationListeners.delete(cb);
|
|
117
|
+
}
|
|
101
118
|
emit(event, data) {
|
|
102
119
|
const set = this.eventListeners.get(event);
|
|
103
120
|
if (!set) {
|
|
@@ -110,6 +127,7 @@ var PositionSocket = class {
|
|
|
110
127
|
};
|
|
111
128
|
export {
|
|
112
129
|
PositionSocket,
|
|
130
|
+
notificationCodes,
|
|
113
131
|
positionEventTypes
|
|
114
132
|
};
|
|
115
133
|
//# sourceMappingURL=index.mjs.map
|
package/dist/ws/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ws/position-socket.ts"],"sourcesContent":["import { camelizeKeys } from \"humps\";\nimport { io, type Socket } from \"socket.io-client\";\nimport type { Position } from \"../types\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/ws/position-socket.ts"],"sourcesContent":["import { camelizeKeys } from \"humps\";\nimport { io, type Socket } from \"socket.io-client\";\nimport type { Position } from \"../types\";\nimport {\n positionEventTypes,\n type NotificationEvent,\n type NotificationEventEnvelope,\n type PositionEvent,\n type PositionEventEnvelope,\n type PositionEventType,\n} from \"./types\";\n\nexport interface PositionSocketOptions {\n baseUrl?: string;\n getToken: () => string | null;\n}\n\ntype EventCallback = (event: PositionEvent) => void;\ntype NotificationCallback = (event: NotificationEvent) => void;\ntype ConnectionCallback = () => void;\ntype ErrorCallback = (error: unknown) => void;\n\nconst wsNamespace = \"/v1/ws/prediction-markets/customer-positions\";\n\nfunction camelizeEnvelope(envelope: PositionEventEnvelope): PositionEvent {\n return {\n id: envelope.id,\n type: envelope.type,\n createdAt: envelope.created_at,\n data: camelizeKeys(envelope.data) as unknown as Position,\n };\n}\n\nexport class PositionSocket {\n private socket: Socket | null = null;\n\n private readonly baseUrl: string;\n\n private readonly getToken: () => string | null;\n\n private readonly eventListeners = new Map<string, Set<EventCallback>>();\n\n private readonly connectListeners = new Set<ConnectionCallback>();\n\n private readonly disconnectListeners = new Set<ConnectionCallback>();\n\n private readonly errorListeners = new Set<ErrorCallback>();\n\n private readonly notificationListeners = new Set<NotificationCallback>();\n\n constructor(options: PositionSocketOptions) {\n this.baseUrl = options.baseUrl ?? \"https://api.dimes.fi\";\n this.getToken = options.getToken;\n }\n\n public get connected(): boolean {\n return this.socket?.connected ?? false;\n }\n\n public connect(): void {\n if (this.socket?.connected) {\n return;\n }\n\n this.socket?.disconnect();\n\n const token = this.getToken();\n if (!token) {\n return;\n }\n\n const getToken = this.getToken;\n this.socket = io(`${this.baseUrl}${wsNamespace}`, {\n auth: (cb) => cb({ token: getToken() }),\n transports: [\"websocket\"],\n reconnection: true,\n reconnectionDelay: 1000,\n reconnectionDelayMax: 30000,\n });\n\n this.socket.on(\"connect\", () => {\n for (const cb of this.connectListeners) {\n cb();\n }\n });\n\n this.socket.on(\"disconnect\", () => {\n for (const cb of this.disconnectListeners) {\n cb();\n }\n });\n\n this.socket.on(\"error\", (err: unknown) => {\n for (const cb of this.errorListeners) {\n cb(err);\n }\n });\n\n for (const eventType of positionEventTypes) {\n this.socket.on(eventType, (envelope: PositionEventEnvelope) => {\n const event = camelizeEnvelope(envelope);\n this.emit(eventType, event);\n this.emit(\"*\", event);\n });\n }\n\n this.socket.on(\"notification\", (envelope: NotificationEventEnvelope) => {\n const event: NotificationEvent = {\n id: envelope.id,\n type: \"notification\",\n createdAt: envelope.created_at,\n data: envelope.data,\n };\n for (const cb of this.notificationListeners) {\n cb(event);\n }\n });\n }\n\n public disconnect(): void {\n this.socket?.disconnect();\n this.socket = null;\n }\n\n public reconnectWithToken(): void {\n this.disconnect();\n this.connect();\n }\n\n public on(event: PositionEventType | \"*\", cb: EventCallback): () => void {\n let set = this.eventListeners.get(event);\n if (!set) {\n set = new Set();\n this.eventListeners.set(event, set);\n }\n set.add(cb);\n return () => set.delete(cb);\n }\n\n public onConnect(cb: ConnectionCallback): () => void {\n this.connectListeners.add(cb);\n return () => this.connectListeners.delete(cb);\n }\n\n public onDisconnect(cb: ConnectionCallback): () => void {\n this.disconnectListeners.add(cb);\n return () => this.disconnectListeners.delete(cb);\n }\n\n public onError(cb: ErrorCallback): () => void {\n this.errorListeners.add(cb);\n return () => this.errorListeners.delete(cb);\n }\n\n public onNotification(cb: NotificationCallback): () => void {\n this.notificationListeners.add(cb);\n return () => this.notificationListeners.delete(cb);\n }\n\n private emit(event: string, data: PositionEvent): void {\n const set = this.eventListeners.get(event);\n if (!set) {\n return;\n }\n for (const cb of set) {\n cb(data);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,UAAuB;AAqBhC,IAAM,cAAc;AAEpB,SAAS,iBAAiB,UAAgD;AACxE,SAAO;AAAA,IACL,IAAI,SAAS;AAAA,IACb,MAAM,SAAS;AAAA,IACf,WAAW,SAAS;AAAA,IACpB,MAAM,aAAa,SAA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,sBAAsB,OAAO,EAAE;AAAA,EACnD;AAAA,EAEQ,KAAK,OAAe,MAA2B;AACrD,UAAM,MAAM,KAAK,eAAe,IAAI,KAAK;AACzC,QAAI,CAAC,KAAK;AACR;AAAA,IACF;AACA,eAAW,MAAM,KAAK;AACpB,SAAG,IAAI;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/alexemery/bl/dimes-sdk/dist/chunk-MSD7A3XX.cjs","../src/ws/types.ts"],"names":[],"mappings":"AAAA;ACEO,IAAM,mBAAA,EAAqB;AAAA,EAChC,oBAAA;AAAA,EACA,0BAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,wBAAA;AAAA,EACA,qBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAAA;ADAA;AACA;AACE;AACF,gDAAC","file":"/Users/alexemery/bl/dimes-sdk/dist/chunk-MSD7A3XX.cjs","sourcesContent":[null,"import type { Position } from \"../types\";\n\nexport const positionEventTypes = [\n \"position.cancelled\",\n \"position.close_requested\",\n \"position.closed\",\n \"position.created\",\n \"position.force_unwound\",\n \"position.liquidated\",\n \"position.opened\",\n \"position.opening\",\n \"position.reverted\",\n \"position.settled\",\n] as const;\n\nexport type PositionEventType = (typeof positionEventTypes)[number];\n\nexport interface PositionEventEnvelope {\n id: string;\n type: PositionEventType;\n created_at: string;\n data: Record<string, unknown>;\n}\n\nexport interface PositionEvent {\n id: string;\n type: PositionEventType;\n createdAt: string;\n data: Position;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ws/types.ts"],"sourcesContent":["import type { Position } from \"../types\";\n\nexport const positionEventTypes = [\n \"position.cancelled\",\n \"position.close_requested\",\n \"position.closed\",\n \"position.created\",\n \"position.force_unwound\",\n \"position.liquidated\",\n \"position.opened\",\n \"position.opening\",\n \"position.reverted\",\n \"position.settled\",\n] as const;\n\nexport type PositionEventType = (typeof positionEventTypes)[number];\n\nexport interface PositionEventEnvelope {\n id: string;\n type: PositionEventType;\n created_at: string;\n data: Record<string, unknown>;\n}\n\nexport interface PositionEvent {\n id: string;\n type: PositionEventType;\n createdAt: string;\n data: Position;\n}\n"],"mappings":";AAEO,IAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { P as Position } from './aliases-CXfmUrAb.cjs';
|
|
2
|
-
|
|
3
|
-
declare const positionEventTypes: readonly ["position.cancelled", "position.close_requested", "position.closed", "position.created", "position.force_unwound", "position.liquidated", "position.opened", "position.opening", "position.reverted", "position.settled"];
|
|
4
|
-
type PositionEventType = (typeof positionEventTypes)[number];
|
|
5
|
-
interface PositionEventEnvelope {
|
|
6
|
-
id: string;
|
|
7
|
-
type: PositionEventType;
|
|
8
|
-
created_at: string;
|
|
9
|
-
data: Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
interface PositionEvent {
|
|
12
|
-
id: string;
|
|
13
|
-
type: PositionEventType;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
data: Position;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { type PositionEvent as P, type PositionEventType as a, type PositionEventEnvelope as b, positionEventTypes as p };
|
package/dist/types-oz2d_Nyk.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { P as Position } from './aliases-CXfmUrAb.js';
|
|
2
|
-
|
|
3
|
-
declare const positionEventTypes: readonly ["position.cancelled", "position.close_requested", "position.closed", "position.created", "position.force_unwound", "position.liquidated", "position.opened", "position.opening", "position.reverted", "position.settled"];
|
|
4
|
-
type PositionEventType = (typeof positionEventTypes)[number];
|
|
5
|
-
interface PositionEventEnvelope {
|
|
6
|
-
id: string;
|
|
7
|
-
type: PositionEventType;
|
|
8
|
-
created_at: string;
|
|
9
|
-
data: Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
interface PositionEvent {
|
|
12
|
-
id: string;
|
|
13
|
-
type: PositionEventType;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
data: Position;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { type PositionEvent as P, type PositionEventType as a, type PositionEventEnvelope as b, positionEventTypes as p };
|