@0xmonaco/types 0.1.5 → 0.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/README.md +190 -73
- package/dist/applications/index.d.ts +24 -0
- package/dist/applications/index.d.ts.map +1 -0
- package/dist/applications/index.js +7 -0
- package/dist/applications/index.js.map +1 -0
- package/dist/applications/responses.d.ts +21 -0
- package/dist/applications/responses.d.ts.map +1 -0
- package/dist/applications/responses.js +7 -0
- package/dist/applications/responses.js.map +1 -0
- package/dist/auth/index.d.ts +72 -91
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/responses.d.ts +37 -37
- package/dist/auth/responses.d.ts.map +1 -1
- package/dist/contracts/balances.d.ts +17 -17
- package/dist/contracts/index.d.ts +5 -5
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/market/index.d.ts +79 -0
- package/dist/market/index.d.ts.map +1 -0
- package/dist/market/index.js +7 -0
- package/dist/market/index.js.map +1 -0
- package/dist/sdk/index.d.ts +13 -5
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +0 -5
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/network.d.ts +4 -3
- package/dist/sdk/network.d.ts.map +1 -1
- package/dist/trading/index.d.ts +4 -14
- package/dist/trading/index.d.ts.map +1 -1
- package/dist/trading/orders.d.ts +4 -0
- package/dist/trading/orders.d.ts.map +1 -1
- package/dist/trading/responses.d.ts +0 -42
- package/dist/trading/responses.d.ts.map +1 -1
- package/dist/vault/index.d.ts +13 -5
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/responses.d.ts +19 -17
- package/dist/vault/responses.d.ts.map +1 -1
- package/dist/websocket/events.d.ts +51 -0
- package/dist/websocket/events.d.ts.map +1 -0
- package/dist/websocket/events.js +7 -0
- package/dist/websocket/events.js.map +1 -0
- package/dist/websocket/index.d.ts +87 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/index.js +7 -0
- package/dist/websocket/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -7,26 +7,28 @@
|
|
|
7
7
|
* Response from a transaction.
|
|
8
8
|
*/
|
|
9
9
|
export interface TransactionResult {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
/** Transaction hash */
|
|
11
|
+
hash: string;
|
|
12
|
+
/** Transaction status */
|
|
13
|
+
status: "pending" | "confirmed" | "failed";
|
|
14
|
+
/** Nonce used for this operation */
|
|
15
|
+
nonce: bigint;
|
|
16
|
+
/** Transaction receipt (only available when autoWait is enabled) */
|
|
17
|
+
receipt?: import('viem').TransactionReceipt;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Token balance information.
|
|
19
21
|
*/
|
|
20
22
|
export interface Balance {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
/** Token address */
|
|
24
|
+
token: string;
|
|
25
|
+
/** Balance amount */
|
|
26
|
+
amount: bigint;
|
|
27
|
+
/** Formatted balance string */
|
|
28
|
+
formatted: string;
|
|
29
|
+
/** Token symbol */
|
|
30
|
+
symbol: string;
|
|
31
|
+
/** Token decimals */
|
|
32
|
+
decimals: number;
|
|
31
33
|
}
|
|
32
|
-
//# sourceMappingURL=responses.d.ts.map
|
|
34
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/vault/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/vault/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,MAAM,EAAE,kBAAkB,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket Event Types
|
|
3
|
+
*
|
|
4
|
+
* Event interfaces for real-time WebSocket communications
|
|
5
|
+
*/
|
|
6
|
+
import { OrderSide, OrderType, TradingMode } from "../trading";
|
|
7
|
+
/**
|
|
8
|
+
* Base interface for all WebSocket events
|
|
9
|
+
*/
|
|
10
|
+
export interface BaseWebSocketEvent {
|
|
11
|
+
/** Event type identifier */
|
|
12
|
+
type: string;
|
|
13
|
+
/** Event timestamp (ISO string) */
|
|
14
|
+
timestamp: string;
|
|
15
|
+
/** Unique event ID */
|
|
16
|
+
eventId: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Order event types
|
|
20
|
+
*/
|
|
21
|
+
export type OrderEventType = "OrderPlaced" | "OrderMatched" | "OrderPartiallyFilled" | "OrderFilled" | "OrderCancelled" | "OrderRejected" | "OrderReplaced" | "OrderExpired";
|
|
22
|
+
/**
|
|
23
|
+
* Order event interface with camelCase properties
|
|
24
|
+
*/
|
|
25
|
+
export interface OrderEvent {
|
|
26
|
+
orderId: string;
|
|
27
|
+
eventType: OrderEventType;
|
|
28
|
+
details: {
|
|
29
|
+
applicationId?: string;
|
|
30
|
+
orderType?: OrderType;
|
|
31
|
+
price?: string;
|
|
32
|
+
quantity?: string;
|
|
33
|
+
side?: OrderSide;
|
|
34
|
+
tradingMode?: TradingMode;
|
|
35
|
+
tradingPair?: string;
|
|
36
|
+
tradingPairId?: string;
|
|
37
|
+
userId: string;
|
|
38
|
+
cancelledAt?: string;
|
|
39
|
+
filledQuantity?: string;
|
|
40
|
+
remainingQuantity?: string;
|
|
41
|
+
reason?: string;
|
|
42
|
+
};
|
|
43
|
+
timestamp: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Subscription configuration for order events
|
|
47
|
+
*/
|
|
48
|
+
export interface OrderSubscriptionConfig {
|
|
49
|
+
eventTypes: OrderEventType[];
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/websocket/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,cAAc,GACd,sBAAsB,GACtB,aAAa,GACb,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE;QACP,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/websocket/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Websocket Types
|
|
3
|
+
*
|
|
4
|
+
* Fundamental definitions for Websocket connections, errors and events.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./events";
|
|
7
|
+
import type { OrderEvent } from "./events";
|
|
8
|
+
/**
|
|
9
|
+
* WebSocket connection configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface WebSocketConfig {
|
|
12
|
+
/** WebSocket URL */
|
|
13
|
+
wsUrl: string;
|
|
14
|
+
/** JWT access token for authentication (optional, can be set later) */
|
|
15
|
+
accessToken?: string;
|
|
16
|
+
/** Auto-reconnect on disconnect (default: true) */
|
|
17
|
+
autoReconnect?: boolean;
|
|
18
|
+
/** Reconnection delay in milliseconds (default: 5000) */
|
|
19
|
+
reconnectDelay?: number;
|
|
20
|
+
/** Maximum reconnection attempts (default: 5) */
|
|
21
|
+
maxReconnectAttempts?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Base error event that can be used across different components
|
|
25
|
+
*/
|
|
26
|
+
export interface BaseErrorEvent {
|
|
27
|
+
type: string;
|
|
28
|
+
message: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
code?: string | number;
|
|
31
|
+
details?: any;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* WebSocket connection status
|
|
35
|
+
*/
|
|
36
|
+
export type ConnectionStatus = "connected" | "disconnected" | "connecting" | "reconnecting";
|
|
37
|
+
/**
|
|
38
|
+
* Base WebSocket client interface
|
|
39
|
+
*/
|
|
40
|
+
export interface BaseWebSocketClient {
|
|
41
|
+
/**
|
|
42
|
+
* Connect to the WebSocket server
|
|
43
|
+
* @returns Promise that resolves when connected
|
|
44
|
+
*/
|
|
45
|
+
connect(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Disconnect from the WebSocket server
|
|
48
|
+
*/
|
|
49
|
+
disconnect(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get current connection status
|
|
52
|
+
* @returns Current connection status
|
|
53
|
+
*/
|
|
54
|
+
getConnectionStatus(): ConnectionStatus;
|
|
55
|
+
/**
|
|
56
|
+
* Check if currently connected
|
|
57
|
+
* @returns True if connected
|
|
58
|
+
*/
|
|
59
|
+
isConnected(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Set the access token for authentication
|
|
62
|
+
* @param token - JWT access token
|
|
63
|
+
*/
|
|
64
|
+
setAccessToken(token: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Send a message through the WebSocket connection
|
|
67
|
+
* @param data - Message data to send
|
|
68
|
+
*/
|
|
69
|
+
send(data: any): void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Order-specific WebSocket client interface
|
|
73
|
+
*/
|
|
74
|
+
export interface OrderWebSocketClient extends BaseWebSocketClient {
|
|
75
|
+
/**
|
|
76
|
+
* Subscribe to order events for a specific market
|
|
77
|
+
* @param market - Market symbol (e.g., 'ETH-USD')
|
|
78
|
+
* @param callback - Callback function for order events
|
|
79
|
+
*/
|
|
80
|
+
subscribeToOrderEvents(market: string, callback: (event: OrderEvent) => void): void;
|
|
81
|
+
/**
|
|
82
|
+
* Unsubscribe from order events for a specific market
|
|
83
|
+
* @param market - Market symbol
|
|
84
|
+
*/
|
|
85
|
+
unsubscribeFromOrderEvents(market: string): void;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,cAAc,GAAG,YAAY,GAAG,cAAc,CAAC;AAG5F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,UAAU,IAAI,IAAI,CAAC;IAEnB;;;OAGG;IACH,mBAAmB,IAAI,gBAAgB,CAAC;IAExC;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;;OAIG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IAEpF;;;OAGG;IACH,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC"}
|