@0xmonaco/types 0.1.6 → 0.2.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 +193 -73
- package/dist/auth/index.d.ts +2 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/market/index.d.ts +130 -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 +11 -3
- package/dist/sdk/index.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 +1 -1
- package/dist/trading/orders.d.ts.map +1 -1
- package/dist/trading/responses.d.ts +44 -52
- package/dist/trading/responses.d.ts.map +1 -1
- package/dist/vault/index.d.ts +11 -9
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/responses.d.ts +2 -0
- package/dist/vault/responses.d.ts.map +1 -1
- package/dist/websocket/index.d.ts +50 -19
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +4 -3
- package/dist/websocket/index.js.map +1 -1
- package/dist/websocket/ohlcv-events.d.ts +32 -0
- package/dist/websocket/ohlcv-events.d.ts.map +1 -0
- package/dist/websocket/ohlcv-events.js +7 -0
- package/dist/websocket/ohlcv-events.js.map +1 -0
- package/dist/websocket/orders-events.d.ts +55 -0
- package/dist/websocket/orders-events.d.ts.map +1 -0
- package/dist/websocket/orders-events.js +7 -0
- package/dist/websocket/orders-events.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @0xmonaco/types
|
|
2
2
|
|
|
3
|
-
Core type definitions for the Monaco protocol. This package provides TypeScript types and interfaces used throughout the Monaco ecosystem, focusing on SDK configuration, vault operations, trading operations, and contract management.
|
|
3
|
+
Core type definitions for the Monaco protocol. This package provides TypeScript types and interfaces used throughout the Monaco ecosystem, focusing on SDK configuration, vault operations, trading operations, market data, and contract management.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -19,28 +19,43 @@ import { MonacoSDK, SDKConfig } from "@0xmonaco/types";
|
|
|
19
19
|
|
|
20
20
|
// SDK configuration
|
|
21
21
|
interface SDKConfig {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
network?: Network; // Network override (defaults to 'mainnet')
|
|
22
|
+
walletClient: WalletClient; // Wallet client for signing operations
|
|
23
|
+
network?: Network; // Network override (defaults to 'mainnet')
|
|
24
|
+
transport?: Transport; // Optional transport for the public client
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
// Main SDK interface
|
|
29
28
|
interface MonacoSDK {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
applications: ApplicationsAPI; // Applications operations API
|
|
30
|
+
auth: AuthAPI; // Auth operations API
|
|
31
|
+
vault: VaultAPI; // Vault operations API
|
|
32
|
+
trading: TradingAPI; // Trading operations API
|
|
33
|
+
market: MarketAPI; // Market metadata API
|
|
34
|
+
profile: ProfileAPI; // Profile operations API
|
|
35
|
+
websocket: {
|
|
36
|
+
orders: OrdersWebSocketClient; // WebSocket client for real-time order events
|
|
37
|
+
ohlcv: OHLCVWebSocketClient; // WebSocket client for real-time OHLCV data
|
|
38
|
+
};
|
|
32
39
|
walletClient: WalletClient; // Wallet client for blockchain operations
|
|
33
40
|
publicClient: PublicClient; // Public client for read-only operations
|
|
34
|
-
|
|
41
|
+
|
|
42
|
+
// Authentication
|
|
43
|
+
login(clientId: string): Promise<AuthState>;
|
|
44
|
+
logout(): Promise<void>;
|
|
45
|
+
refreshAuth(): Promise<AuthState>;
|
|
46
|
+
getAuthState(): AuthState | undefined;
|
|
47
|
+
|
|
35
48
|
// Account management
|
|
49
|
+
isAuthenticated(): boolean;
|
|
36
50
|
isConnected(): boolean;
|
|
37
51
|
getAccountAddress(): string;
|
|
38
52
|
getNetwork(): Network;
|
|
39
53
|
getChainId(): number;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
waitForTransaction(
|
|
55
|
+
hash: string,
|
|
56
|
+
confirmations?: number,
|
|
57
|
+
timeout?: number
|
|
58
|
+
): Promise<TransactionReceipt>;
|
|
44
59
|
}
|
|
45
60
|
```
|
|
46
61
|
|
|
@@ -52,13 +67,25 @@ Types for vault operations including deposits, withdrawals, and balance manageme
|
|
|
52
67
|
import { VaultAPI, Balance, TransactionResult } from "@0xmonaco/types";
|
|
53
68
|
|
|
54
69
|
// Vault operations
|
|
55
|
-
interface VaultAPI {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
interface VaultAPI extends BaseAPI {
|
|
71
|
+
setVaultAddress(vaultAddress: Address): void;
|
|
72
|
+
getVaultAddress(): Address | undefined;
|
|
73
|
+
approve(
|
|
74
|
+
token: string,
|
|
75
|
+
amount: bigint,
|
|
76
|
+
autoWait?: boolean
|
|
77
|
+
): Promise<TransactionResult>;
|
|
78
|
+
deposit(
|
|
79
|
+
token: string,
|
|
80
|
+
amount: bigint,
|
|
81
|
+
autoWait?: boolean
|
|
82
|
+
): Promise<TransactionResult>;
|
|
83
|
+
withdraw(
|
|
84
|
+
token: string,
|
|
85
|
+
amount: bigint,
|
|
86
|
+
autoWait?: boolean
|
|
87
|
+
): Promise<TransactionResult>;
|
|
59
88
|
getBalance(token: string): Promise<Balance>;
|
|
60
|
-
getAllowance(token: string): Promise<bigint>;
|
|
61
|
-
needsApproval(token: string, amount: bigint): Promise<boolean>;
|
|
62
89
|
}
|
|
63
90
|
|
|
64
91
|
// Vault response types
|
|
@@ -74,6 +101,7 @@ interface TransactionResult {
|
|
|
74
101
|
hash: string;
|
|
75
102
|
status: "pending" | "confirmed" | "failed";
|
|
76
103
|
nonce: bigint;
|
|
104
|
+
receipt?: TransactionReceipt;
|
|
77
105
|
}
|
|
78
106
|
```
|
|
79
107
|
|
|
@@ -82,62 +110,134 @@ interface TransactionResult {
|
|
|
82
110
|
Types for trading operations including order placement and management:
|
|
83
111
|
|
|
84
112
|
```typescript
|
|
85
|
-
import {
|
|
86
|
-
TradingAPI,
|
|
87
|
-
OrderSide,
|
|
88
|
-
OrderType,
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
import {
|
|
114
|
+
TradingAPI,
|
|
115
|
+
OrderSide,
|
|
116
|
+
OrderType,
|
|
117
|
+
CreateOrderResponse,
|
|
118
|
+
CancelOrderResponse,
|
|
119
|
+
ReplaceOrderResponse,
|
|
120
|
+
GetPaginatedOrdersResponse,
|
|
121
|
+
GetOrderResponse,
|
|
91
122
|
} from "@0xmonaco/types";
|
|
92
123
|
|
|
93
124
|
// Trading operations
|
|
94
|
-
interface TradingAPI {
|
|
95
|
-
placeLimitOrder(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
125
|
+
interface TradingAPI extends BaseAPI {
|
|
126
|
+
placeLimitOrder(
|
|
127
|
+
market: string,
|
|
128
|
+
side: OrderSide,
|
|
129
|
+
quantity: string,
|
|
130
|
+
price: string,
|
|
131
|
+
options?: {
|
|
132
|
+
tradingMode?: string;
|
|
133
|
+
useMasterBalance?: boolean;
|
|
134
|
+
expirationDate?: string;
|
|
135
|
+
}
|
|
136
|
+
): Promise<CreateOrderResponse>;
|
|
137
|
+
|
|
138
|
+
placeMarketOrder(
|
|
139
|
+
market: string,
|
|
140
|
+
side: OrderSide,
|
|
141
|
+
quantity: string,
|
|
142
|
+
options?: { tradingMode?: string }
|
|
143
|
+
): Promise<CreateOrderResponse>;
|
|
144
|
+
|
|
99
145
|
cancelOrder(orderId: string): Promise<CancelOrderResponse>;
|
|
100
|
-
|
|
146
|
+
|
|
147
|
+
replaceOrder(
|
|
148
|
+
orderId: string,
|
|
149
|
+
newOrder: {
|
|
150
|
+
price?: string;
|
|
151
|
+
quantity: string;
|
|
152
|
+
useMasterBalance?: boolean;
|
|
153
|
+
}
|
|
154
|
+
): Promise<ReplaceOrderResponse>;
|
|
155
|
+
|
|
156
|
+
getPaginatedOrders(
|
|
157
|
+
params?: GetPaginatedOrdersParams
|
|
158
|
+
): Promise<GetPaginatedOrdersResponse>;
|
|
159
|
+
getOrder(orderId: string): Promise<GetOrderResponse>;
|
|
101
160
|
}
|
|
102
161
|
|
|
103
162
|
// Trading types
|
|
104
|
-
type OrderSide = "
|
|
105
|
-
|
|
106
|
-
type
|
|
107
|
-
type
|
|
108
|
-
|
|
109
|
-
interface OrderIntent {
|
|
110
|
-
market: string;
|
|
111
|
-
side: OrderSide;
|
|
112
|
-
size: string;
|
|
113
|
-
orderType: OrderType;
|
|
114
|
-
userAddress: string;
|
|
115
|
-
timestamp: bigint;
|
|
116
|
-
nonce: bigint;
|
|
117
|
-
price?: string;
|
|
118
|
-
timeInForce?: TimeInForce;
|
|
119
|
-
slippageTolerance?: string;
|
|
120
|
-
}
|
|
163
|
+
type OrderSide = "BUY" | "SELL";
|
|
164
|
+
type OrderType = "LIMIT" | "MARKET";
|
|
165
|
+
type OrderStatus = "PENDING" | "FILLED" | "CANCELLED" | "REJECTED";
|
|
166
|
+
type TradingMode = "SPOT";
|
|
121
167
|
|
|
122
168
|
// Trading response types
|
|
123
|
-
interface
|
|
124
|
-
|
|
125
|
-
status: "
|
|
126
|
-
|
|
169
|
+
interface CreateOrderResponse {
|
|
170
|
+
order_id: string;
|
|
171
|
+
status: "SUCCESS" | "FAILED";
|
|
172
|
+
match_result?: {
|
|
173
|
+
remaining_quantity: string;
|
|
174
|
+
status: string;
|
|
175
|
+
};
|
|
127
176
|
}
|
|
128
177
|
|
|
129
178
|
interface CancelOrderResponse {
|
|
130
|
-
|
|
131
|
-
status: "
|
|
132
|
-
|
|
179
|
+
order_id: string;
|
|
180
|
+
status: "SUCCESS" | "FAILED";
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface ReplaceOrderResponse {
|
|
184
|
+
order_id: string;
|
|
185
|
+
status: "SUCCESS" | "FAILED";
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Market Types
|
|
190
|
+
|
|
191
|
+
Types for market data operations including trading pair metadata:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import {
|
|
195
|
+
MarketAPI,
|
|
196
|
+
TradingPair,
|
|
197
|
+
GetTradingPairsResponse,
|
|
198
|
+
GetTradingPairResponse,
|
|
199
|
+
} from "@0xmonaco/types";
|
|
200
|
+
|
|
201
|
+
// Market operations
|
|
202
|
+
interface MarketAPI extends BaseAPI {
|
|
203
|
+
getTradingPairs(): Promise<TradingPair[]>;
|
|
204
|
+
getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Market data types
|
|
208
|
+
interface TradingPair {
|
|
209
|
+
id: string;
|
|
210
|
+
symbol: string;
|
|
211
|
+
base_token: string;
|
|
212
|
+
quote_token: string;
|
|
213
|
+
base_token_contract: string;
|
|
214
|
+
quote_token_contract: string;
|
|
215
|
+
base_decimals: number;
|
|
216
|
+
quote_decimals: number;
|
|
217
|
+
market_type: string;
|
|
218
|
+
is_active: boolean;
|
|
219
|
+
maker_fee_bps: number;
|
|
220
|
+
taker_fee_bps: number;
|
|
221
|
+
min_order_size: string;
|
|
222
|
+
max_order_size: string;
|
|
223
|
+
tick_size: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Market response types
|
|
227
|
+
interface GetTradingPairsResponse {
|
|
228
|
+
data: {
|
|
229
|
+
data: TradingPair[];
|
|
230
|
+
limit: number;
|
|
231
|
+
page: number;
|
|
232
|
+
total: number;
|
|
233
|
+
total_pages: number;
|
|
234
|
+
};
|
|
235
|
+
success: boolean;
|
|
133
236
|
}
|
|
134
237
|
|
|
135
|
-
interface
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
closedSize?: bigint;
|
|
139
|
-
remainingSize?: bigint;
|
|
140
|
-
timestamp: number;
|
|
238
|
+
interface GetTradingPairResponse {
|
|
239
|
+
data: TradingPair;
|
|
240
|
+
success: boolean;
|
|
141
241
|
}
|
|
142
242
|
```
|
|
143
243
|
|
|
@@ -146,7 +246,12 @@ interface ClosePositionResponse {
|
|
|
146
246
|
Types for contract addresses, instances, and contract-related operations:
|
|
147
247
|
|
|
148
248
|
```typescript
|
|
149
|
-
import {
|
|
249
|
+
import {
|
|
250
|
+
ContractAddresses,
|
|
251
|
+
ContractInstances,
|
|
252
|
+
Token,
|
|
253
|
+
UserBalance,
|
|
254
|
+
} from "@0xmonaco/types";
|
|
150
255
|
|
|
151
256
|
// Contract addresses
|
|
152
257
|
interface ContractAddresses {
|
|
@@ -192,9 +297,10 @@ interface NetworkEndpoints {
|
|
|
192
297
|
|
|
193
298
|
### SDK Types
|
|
194
299
|
|
|
195
|
-
- `MonacoSDK`: Main SDK interface with
|
|
300
|
+
- `MonacoSDK`: Main SDK interface with all API modules
|
|
196
301
|
- `SDKConfig`: Configuration options for the Monaco SDK
|
|
197
302
|
- `Network`: Network type ("mainnet" | "testnet")
|
|
303
|
+
- `AuthState`: Authentication state information
|
|
198
304
|
|
|
199
305
|
### Vault Types
|
|
200
306
|
|
|
@@ -205,12 +311,18 @@ interface NetworkEndpoints {
|
|
|
205
311
|
### Trading Types
|
|
206
312
|
|
|
207
313
|
- `TradingAPI`: Interface for trading operations (orders, positions)
|
|
208
|
-
- `OrderSide`: Order side type ("
|
|
209
|
-
- `OrderType`: Order type
|
|
210
|
-
- `
|
|
211
|
-
- `OrderResponse`: Response from order operations
|
|
314
|
+
- `OrderSide`: Order side type ("BUY" | "SELL")
|
|
315
|
+
- `OrderType`: Order type ("LIMIT" | "MARKET")
|
|
316
|
+
- `CreateOrderResponse`: Response from order placement
|
|
212
317
|
- `CancelOrderResponse`: Response from order cancellation
|
|
213
|
-
- `
|
|
318
|
+
- `ReplaceOrderResponse`: Response from order replacement
|
|
319
|
+
|
|
320
|
+
### Market Types
|
|
321
|
+
|
|
322
|
+
- `MarketAPI`: Interface for market data operations
|
|
323
|
+
- `TradingPair`: Trading pair metadata with all market information
|
|
324
|
+
- `GetTradingPairsResponse`: Response wrapper for trading pairs list
|
|
325
|
+
- `GetTradingPairResponse`: Response wrapper for single trading pair
|
|
214
326
|
|
|
215
327
|
### Contract Types
|
|
216
328
|
|
|
@@ -225,19 +337,27 @@ The types package is organized into domain-specific modules:
|
|
|
225
337
|
|
|
226
338
|
```
|
|
227
339
|
src/
|
|
340
|
+
├── api/ # Base API types
|
|
341
|
+
│ └── index.ts # Common API interfaces
|
|
342
|
+
├── applications/ # Applications types
|
|
343
|
+
├── auth/ # Authentication types
|
|
344
|
+
├── contracts/ # Contract types
|
|
345
|
+
│ ├── index.ts # Contract interfaces
|
|
346
|
+
│ └── balances.ts # Balance-related types
|
|
347
|
+
├── market/ # Market data types
|
|
348
|
+
│ └── index.ts # Market API interface and types
|
|
349
|
+
├── profile/ # Profile types
|
|
228
350
|
├── sdk/ # SDK types
|
|
229
351
|
│ ├── index.ts # Main SDK interfaces and configuration
|
|
230
352
|
│ └── network.ts # Network-related types
|
|
231
|
-
├── vault/ # Vault types
|
|
232
|
-
│ ├── index.ts # Vault API interface
|
|
233
|
-
│ └── responses.ts # Vault response types
|
|
234
353
|
├── trading/ # Trading types
|
|
235
354
|
│ ├── index.ts # Trading API interface
|
|
236
355
|
│ ├── orders.ts # Order-related types
|
|
237
356
|
│ └── responses.ts # Trading response types
|
|
238
|
-
├──
|
|
239
|
-
│ ├── index.ts #
|
|
240
|
-
│ └──
|
|
357
|
+
├── vault/ # Vault types
|
|
358
|
+
│ ├── index.ts # Vault API interface
|
|
359
|
+
│ └── responses.ts # Vault response types
|
|
360
|
+
├── websocket/ # WebSocket types
|
|
241
361
|
└── index.ts # Package exports
|
|
242
362
|
```
|
|
243
363
|
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Types for authentication operations including challenge creation,
|
|
5
5
|
* signature verification, and backend authentication.
|
|
6
6
|
*/
|
|
7
|
+
import { BaseAPI } from "..";
|
|
7
8
|
import type { BackendAuthResponse, ChallengeResponse, TokenRefreshResponse, User, VerifyResponse } from "./responses";
|
|
8
9
|
/**
|
|
9
10
|
* Auth API interface.
|
|
10
11
|
* Provides methods for frontend and backend authentication.
|
|
11
12
|
* Handles challenge creation, signature verification, and backend auth.
|
|
12
13
|
*/
|
|
13
|
-
export interface AuthAPI {
|
|
14
|
+
export interface AuthAPI extends BaseAPI {
|
|
14
15
|
/**
|
|
15
16
|
* Complete authentication flow for frontend applications.
|
|
16
17
|
*
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMtH;;;;GAIG;AACH,MAAM,WAAW,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMtH;;;;GAIG;AACH,MAAM,WAAW,OAAQ,SAAQ,OAAO;IAEtC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAExD;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhD;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE/E;;;;;;;;OAQG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9G;;;;;OAKG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAErE;;;;OAIG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAElE;;;;OAIG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,IAAI,EAAE,IAAI,CAAC;IACX,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qCAAqC;AACrC,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qCAAqC;AACrC,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Market Types
|
|
3
|
+
*
|
|
4
|
+
* Types for market data operations including trading pair metadata and OHLCV data.
|
|
5
|
+
*/
|
|
6
|
+
import { type BaseAPI } from "../api";
|
|
7
|
+
/**
|
|
8
|
+
* Trading pair metadata
|
|
9
|
+
*/
|
|
10
|
+
export interface TradingPair {
|
|
11
|
+
/** Unique identifier */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Trading pair symbol e.g. BTC/USDC */
|
|
14
|
+
symbol: string;
|
|
15
|
+
/** Base token symbol */
|
|
16
|
+
base_token: string;
|
|
17
|
+
/** Quote token symbol */
|
|
18
|
+
quote_token: string;
|
|
19
|
+
/** Base token contract address */
|
|
20
|
+
base_token_contract: string;
|
|
21
|
+
/** Quote token contract address */
|
|
22
|
+
quote_token_contract: string;
|
|
23
|
+
/** Base token decimals */
|
|
24
|
+
base_decimals: number;
|
|
25
|
+
/** Quote token decimals */
|
|
26
|
+
quote_decimals: number;
|
|
27
|
+
/** Market type (e.g. SPOT) */
|
|
28
|
+
market_type: string;
|
|
29
|
+
/** Whether the market is active */
|
|
30
|
+
is_active: boolean;
|
|
31
|
+
/** Maker fee in basis points */
|
|
32
|
+
maker_fee_bps: number;
|
|
33
|
+
/** Taker fee in basis points */
|
|
34
|
+
taker_fee_bps: number;
|
|
35
|
+
/** Minimum order size */
|
|
36
|
+
min_order_size: string;
|
|
37
|
+
/** Maximum order size */
|
|
38
|
+
max_order_size: string;
|
|
39
|
+
/** Tick size for price increments */
|
|
40
|
+
tick_size: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* OHLCV candlestick data point (matches API response format)
|
|
44
|
+
*
|
|
45
|
+
* Note: Field naming follows backend API format where:
|
|
46
|
+
* - T = Start timestamp (open_time from backend)
|
|
47
|
+
* - t = End timestamp (close_time from backend)
|
|
48
|
+
*/
|
|
49
|
+
export interface Candlestick {
|
|
50
|
+
/** Start timestamp for the candlestick period (Unix timestamp in milliseconds) */
|
|
51
|
+
T: number;
|
|
52
|
+
/** End timestamp for the candlestick period (Unix timestamp in milliseconds) */
|
|
53
|
+
t: number;
|
|
54
|
+
/** Opening price */
|
|
55
|
+
o: string;
|
|
56
|
+
/** Highest price during the period */
|
|
57
|
+
h: string;
|
|
58
|
+
/** Lowest price during the period */
|
|
59
|
+
l: string;
|
|
60
|
+
/** Closing price */
|
|
61
|
+
c: string;
|
|
62
|
+
/** Volume traded during the period */
|
|
63
|
+
v: string;
|
|
64
|
+
/** Symbol */
|
|
65
|
+
s: string;
|
|
66
|
+
/** Interval */
|
|
67
|
+
i: string;
|
|
68
|
+
/** Number of trades (optional) */
|
|
69
|
+
n?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Supported candlestick intervals
|
|
73
|
+
*/
|
|
74
|
+
export type CandlestickInterval = "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
|
|
75
|
+
/**
|
|
76
|
+
* Candlestick subscription configuration
|
|
77
|
+
*/
|
|
78
|
+
export interface CandlestickSubscription {
|
|
79
|
+
/** Trading pair symbol (e.g., "WETH-USDC") */
|
|
80
|
+
symbol: string;
|
|
81
|
+
/** Candlestick interval */
|
|
82
|
+
interval: CandlestickInterval;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* API response wrapper for trading pairs
|
|
86
|
+
*/
|
|
87
|
+
export interface GetTradingPairsResponse {
|
|
88
|
+
data: {
|
|
89
|
+
data: TradingPair[];
|
|
90
|
+
limit: number;
|
|
91
|
+
page: number;
|
|
92
|
+
total: number;
|
|
93
|
+
total_pages: number;
|
|
94
|
+
};
|
|
95
|
+
success: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* API response wrapper for single trading pair
|
|
99
|
+
*/
|
|
100
|
+
export interface GetTradingPairResponse {
|
|
101
|
+
data: TradingPair;
|
|
102
|
+
success: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Market API interface.
|
|
106
|
+
* Provides methods for fetching market metadata and trading pair information.
|
|
107
|
+
*/
|
|
108
|
+
export interface MarketAPI extends BaseAPI {
|
|
109
|
+
/**
|
|
110
|
+
* Fetch all available trading pairs supported by Monaco.
|
|
111
|
+
* @returns Promise resolving to array of trading pairs
|
|
112
|
+
*/
|
|
113
|
+
getTradingPairs(): Promise<TradingPair[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Fetch metadata for a single trading pair by its symbol (e.g. BTC-USDC).
|
|
116
|
+
* @param symbol - Trading pair symbol
|
|
117
|
+
* @returns Promise resolving to trading pair or undefined if not found
|
|
118
|
+
*/
|
|
119
|
+
getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
|
|
120
|
+
/**
|
|
121
|
+
* Fetch historical candlestick data for a trading pair.
|
|
122
|
+
* @param symbol - Trading pair symbol (e.g., "WETH-USDC")
|
|
123
|
+
* @param interval - Candlestick interval
|
|
124
|
+
* @param startTime - Start time as Unix timestamp in milliseconds
|
|
125
|
+
* @param endTime - End time as Unix timestamp in milliseconds
|
|
126
|
+
* @returns Promise resolving to array of candlesticks
|
|
127
|
+
*/
|
|
128
|
+
getCandlesticks(symbol: string, interval: CandlestickInterval, startTime: number, endTime: number): Promise<Candlestick[]>;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/market/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMtC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mCAAmC;IACnC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,0BAA0B;IAC1B,aAAa,EAAE,MAAM,CA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I,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,OAAO;IACxC;;;OAGG;IACH,eAAe,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAE1C;;;;OAIG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IAEzE;;;;;;;OAOG;IACH,eAAe,CACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/market/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import type { ApplicationsAPI } from "../applications";
|
|
|
3
3
|
import type { AuthAPI, AuthState } from "../auth";
|
|
4
4
|
import type { ProfileAPI } from "../profile";
|
|
5
5
|
import type { TradingAPI } from "../trading";
|
|
6
|
+
import type { MarketAPI } from "../market";
|
|
6
7
|
import type { VaultAPI } from "../vault";
|
|
7
|
-
import type {
|
|
8
|
+
import type { OrdersWebSocketClient, OHLCVWebSocketClient } from "../websocket";
|
|
8
9
|
import type { Network } from "./network";
|
|
9
10
|
/**
|
|
10
11
|
* Configuration options for the Monaco SDK.
|
|
@@ -32,10 +33,17 @@ export interface MonacoSDK {
|
|
|
32
33
|
vault: VaultAPI;
|
|
33
34
|
/** Trading operations API */
|
|
34
35
|
trading: TradingAPI;
|
|
36
|
+
/** Market metadata API */
|
|
37
|
+
market: MarketAPI;
|
|
35
38
|
/** Profile operations API */
|
|
36
39
|
profile: ProfileAPI;
|
|
37
|
-
/** WebSocket
|
|
38
|
-
websocket:
|
|
40
|
+
/** WebSocket clients for real-time data */
|
|
41
|
+
websocket: {
|
|
42
|
+
/** Order events websocket client */
|
|
43
|
+
orders: OrdersWebSocketClient;
|
|
44
|
+
/** OHLCV data websocket client */
|
|
45
|
+
ohlcv: OHLCVWebSocketClient;
|
|
46
|
+
};
|
|
39
47
|
/** Wallet client for all blockchain operations */
|
|
40
48
|
walletClient: WalletClient;
|
|
41
49
|
/** Public client for read-only blockchain operations */
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,YAAY,EACb,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC;;;;;G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C;IAErB,6CAA6C;IAC7C,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAChC;AAGD,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type BaseAPI } from "../api";
|
|
7
7
|
import { type OrderSide } from "./orders";
|
|
8
|
-
import { type CancelOrderResponse, type
|
|
8
|
+
import { type CancelOrderResponse, type CreateOrderResponse, type ReplaceOrderResponse, type GetPaginatedOrdersResponse, type GetPaginatedOrdersParams, type GetOrderResponse } from "./responses";
|
|
9
9
|
/**
|
|
10
10
|
* Trading API interface.
|
|
11
11
|
* Provides methods for placing and managing orders.
|
|
@@ -34,10 +34,12 @@ export interface TradingAPI extends BaseAPI {
|
|
|
34
34
|
* @param quantity - Order quantity as string
|
|
35
35
|
* @param options - Optional parameters for the market order
|
|
36
36
|
* @param options.tradingMode - Trading mode (e.g., "SPOT")
|
|
37
|
+
* @param options.slippageTolerance - Slippage tolerance as decimal (e.g., 0.01 for 1%, optional)
|
|
37
38
|
* @returns Promise resolving to the order result
|
|
38
39
|
*/
|
|
39
40
|
placeMarketOrder(market: string, side: OrderSide, quantity: string, options?: {
|
|
40
41
|
tradingMode?: string;
|
|
42
|
+
slippageTolerance?: number;
|
|
41
43
|
}): Promise<CreateOrderResponse>;
|
|
42
44
|
/**
|
|
43
45
|
* Cancels an existing order.
|
|
@@ -45,18 +47,6 @@ export interface TradingAPI extends BaseAPI {
|
|
|
45
47
|
* @returns Promise resolving to the cancellation result
|
|
46
48
|
*/
|
|
47
49
|
cancelOrder(orderId: string): Promise<CancelOrderResponse>;
|
|
48
|
-
/**
|
|
49
|
-
* Updates an existing order (price and/or quantity).
|
|
50
|
-
* @param orderId - ID of the order to update
|
|
51
|
-
* @param updates - Fields to update
|
|
52
|
-
* @param updates.price - New price (optional)
|
|
53
|
-
* @param updates.quantity - New quantity (optional)
|
|
54
|
-
* @returns Promise resolving to the update result
|
|
55
|
-
*/
|
|
56
|
-
updateOrder(orderId: string, updates: {
|
|
57
|
-
price?: string;
|
|
58
|
-
quantity?: string;
|
|
59
|
-
}): Promise<UpdateOrderResponse>;
|
|
60
50
|
/**
|
|
61
51
|
* Replaces an existing order with new parameters.
|
|
62
52
|
* Updates the order with new price, quantity, and balance settings.
|
|
@@ -90,5 +80,5 @@ export interface TradingAPI extends BaseAPI {
|
|
|
90
80
|
getOrder(orderId: string): Promise<GetOrderResponse>;
|
|
91
81
|
}
|
|
92
82
|
export type { Order, OrderSide, OrderType, OrderStatus, TradingMode, } from "./orders";
|
|
93
|
-
export type {
|
|
83
|
+
export type { CancelOrderResponse, CreateOrderResponse, ReplaceOrderResponse, GetPaginatedOrdersResponse, GetPaginatedOrdersParams, GetOrderResponse, } from "./responses";
|
|
94
84
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trading/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trading/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB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S,EACT,SAAS,EACT,WAAW,EACX,WAAW,GACX,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,aAAa,CAAC"}
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../src/trading/orders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;GAGG;AACH,MAAM,WAAW,KAAK;IACrB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,iBAAiB;IACjB,UAAU,EAAE,SAAS,CAAC;IACtB,mBAAmB;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB;IACnB,YAAY,EAAE,WAAW,CAAC;IAC1B,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,WAAW,GACpB,SAAS,GACT,WAAW,GACX,QAAQ,GACR,WAAW,GACX,UAAU,GACV,kBAAkB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../src/trading/orders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;GAGG;AACH,MAAM,WAAW,KAAK;IACrB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,iBAAiB;IACjB,UAAU,EAAE,SAAS,CAAC;IACtB,mBAAmB;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB;IACnB,YAAY,EAAE,WAAW,CAAC;IAC1B,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,WAAW,GACpB,SAAS,GACT,WAAW,GACX,QAAQ,GACR,WAAW,GACX,UAAU,GACV,kBAAkB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC"}
|
|
@@ -5,15 +5,31 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Order, OrderStatus } from "./orders";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Match result information for order execution.
|
|
9
|
+
* Contains detailed information about trades, fills, and execution quality.
|
|
9
10
|
*/
|
|
10
|
-
export interface
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
|
|
11
|
+
export interface MatchResult {
|
|
12
|
+
/** Number of trades executed */
|
|
13
|
+
trades_count: number;
|
|
14
|
+
/** Total quantity filled across all trades */
|
|
15
|
+
total_filled: string;
|
|
16
|
+
/** Remaining quantity after immediate matches */
|
|
17
|
+
remaining_quantity: string;
|
|
18
|
+
/** Average price across all fills (null if no fills) */
|
|
19
|
+
average_fill_price: string | null;
|
|
20
|
+
/** Status of the match */
|
|
21
|
+
status: string;
|
|
22
|
+
/** Actual slippage in basis points (null if no fills) */
|
|
23
|
+
actual_slippage_bps: number | null;
|
|
24
|
+
/** Maximum allowed slippage in basis points (null if not set) */
|
|
25
|
+
max_slippage_bps: number | null;
|
|
26
|
+
/** Price range of execution (null if no fills) */
|
|
27
|
+
execution_price_range: {
|
|
28
|
+
/** Best execution price achieved */
|
|
29
|
+
best_price: string;
|
|
30
|
+
/** Worst execution price achieved */
|
|
31
|
+
worst_price: string;
|
|
32
|
+
} | null;
|
|
17
33
|
}
|
|
18
34
|
/**
|
|
19
35
|
* Response from creating an order.
|
|
@@ -23,13 +39,10 @@ export interface CreateOrderResponse {
|
|
|
23
39
|
order_id: string;
|
|
24
40
|
/** Order status */
|
|
25
41
|
status: "SUCCESS" | "FAILED";
|
|
42
|
+
/** Optional response message */
|
|
43
|
+
message?: string;
|
|
26
44
|
/** Match result information */
|
|
27
|
-
match_result?:
|
|
28
|
-
/** Remaining quantity after immediate matches */
|
|
29
|
-
remaining_quantity: string;
|
|
30
|
-
/** Status of the match */
|
|
31
|
-
status: string;
|
|
32
|
-
};
|
|
45
|
+
match_result?: MatchResult;
|
|
33
46
|
}
|
|
34
47
|
/**
|
|
35
48
|
* Response from cancelling an order.
|
|
@@ -39,55 +52,34 @@ export interface CancelOrderResponse {
|
|
|
39
52
|
order_id: string;
|
|
40
53
|
/** Cancellation status */
|
|
41
54
|
status: "SUCCESS" | "FAILED";
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* Response from updating an order.
|
|
45
|
-
*/
|
|
46
|
-
export interface UpdateOrderResponse {
|
|
47
|
-
/** Order identifier */
|
|
48
|
-
order_id: string;
|
|
49
|
-
/** Update status */
|
|
50
|
-
status: "SUCCESS" | "FAILED";
|
|
51
|
-
/** Updated fields */
|
|
52
|
-
updated_fields: {
|
|
53
|
-
/** Updated price if changed */
|
|
54
|
-
price?: string;
|
|
55
|
-
/** Updated quantity if changed */
|
|
56
|
-
quantity?: string;
|
|
57
|
-
};
|
|
55
|
+
/** Optional response message */
|
|
56
|
+
message?: string;
|
|
58
57
|
}
|
|
59
58
|
/**
|
|
60
59
|
* Response from replacing an order.
|
|
61
60
|
*/
|
|
62
61
|
export interface ReplaceOrderResponse {
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
/** New order identifier */
|
|
66
|
-
new_order_id: string;
|
|
62
|
+
/** New order identifier (after replacement) */
|
|
63
|
+
order_id: string;
|
|
67
64
|
/** Replace operation status */
|
|
68
65
|
status: "SUCCESS" | "FAILED";
|
|
66
|
+
/** Operation message */
|
|
67
|
+
message: string;
|
|
68
|
+
/** Fields that were updated */
|
|
69
|
+
updated_fields: UpdatedFields;
|
|
70
|
+
/** Original order identifier that was replaced */
|
|
71
|
+
original_order_id?: string;
|
|
69
72
|
/** Match result information for the new order */
|
|
70
|
-
match_result?:
|
|
71
|
-
/** Remaining quantity after immediate matches */
|
|
72
|
-
remaining_quantity: string;
|
|
73
|
-
/** Status of the match */
|
|
74
|
-
status: string;
|
|
75
|
-
};
|
|
73
|
+
match_result?: MatchResult;
|
|
76
74
|
}
|
|
77
75
|
/**
|
|
78
|
-
*
|
|
76
|
+
* Fields that were updated in the replace operation
|
|
79
77
|
*/
|
|
80
|
-
export interface
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
/** Amount that was closed */
|
|
86
|
-
closedSize?: bigint;
|
|
87
|
-
/** Remaining position size */
|
|
88
|
-
remainingSize?: bigint;
|
|
89
|
-
/** Timestamp of the response */
|
|
90
|
-
timestamp: number;
|
|
78
|
+
export interface UpdatedFields {
|
|
79
|
+
/** Updated price (if changed) */
|
|
80
|
+
price?: string;
|
|
81
|
+
/** Updated quantity (if changed) */
|
|
82
|
+
quantity?: string;
|
|
91
83
|
}
|
|
92
84
|
/**
|
|
93
85
|
* Query parameters for getting paginated orders
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/trading/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/trading/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iEAAiE;IACjE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,kDAAkD;IAClD,qBAAqB,EAAE;QACrB,oCAAoC;QACpC,UAAU,EAAE,MAAM,CAAC;QACnB,qCAAqC;QACrC,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI,CAAC;CACV;AAED;;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sB;IACtB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,qBAAqB;IACrB,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC9B"}
|
package/dist/vault/index.d.ts
CHANGED
|
@@ -11,33 +11,30 @@ import type { Balance, TransactionResult } from "./responses";
|
|
|
11
11
|
* Handles token approvals and balance management.
|
|
12
12
|
*/
|
|
13
13
|
export interface VaultAPI extends BaseAPI {
|
|
14
|
-
/**
|
|
15
|
-
* Set the address of the vault.
|
|
16
|
-
* @param vaultAddress - Address of the vault
|
|
17
|
-
* @returns void
|
|
18
|
-
*/
|
|
19
|
-
setVaultAddress(vaultAddress: string): void;
|
|
20
14
|
/**
|
|
21
15
|
* Approves the vault to spend tokens.
|
|
22
16
|
* @param token - Address of the token to approve
|
|
23
17
|
* @param amount - Amount to approve
|
|
18
|
+
* @param autoWait - Whether to automatically wait for transaction confirmation (defaults to true)
|
|
24
19
|
* @returns Promise resolving to the transaction result
|
|
25
20
|
*/
|
|
26
|
-
approve(token: string, amount: bigint): Promise<TransactionResult>;
|
|
21
|
+
approve(token: string, amount: bigint, autoWait?: boolean): Promise<TransactionResult>;
|
|
27
22
|
/**
|
|
28
23
|
* Deposits tokens into the vault.
|
|
29
24
|
* @param token - Address of the token to deposit
|
|
30
25
|
* @param amount - Amount to deposit
|
|
26
|
+
* @param autoWait - Whether to automatically wait for transaction confirmation (defaults to true)
|
|
31
27
|
* @returns Promise resolving to the transaction result
|
|
32
28
|
*/
|
|
33
|
-
deposit(token: string, amount: bigint): Promise<TransactionResult>;
|
|
29
|
+
deposit(token: string, amount: bigint, autoWait?: boolean): Promise<TransactionResult>;
|
|
34
30
|
/**
|
|
35
31
|
* Withdraws tokens from the vault.
|
|
36
32
|
* @param token - Address of the token to withdraw
|
|
37
33
|
* @param amount - Amount to withdraw
|
|
34
|
+
* @param autoWait - Whether to automatically wait for transaction confirmation (defaults to true)
|
|
38
35
|
* @returns Promise resolving to the transaction result
|
|
39
36
|
*/
|
|
40
|
-
withdraw(token: string, amount: bigint): Promise<TransactionResult>;
|
|
37
|
+
withdraw(token: string, amount: bigint, autoWait?: boolean): Promise<TransactionResult>;
|
|
41
38
|
/**
|
|
42
39
|
* Gets the balance of a token in the vault.
|
|
43
40
|
* @param token - Address of the token to check
|
|
@@ -57,6 +54,11 @@ export interface VaultAPI extends BaseAPI {
|
|
|
57
54
|
* @returns Promise resolving to whether approval is needed
|
|
58
55
|
*/
|
|
59
56
|
needsApproval(token: string, amount: bigint): Promise<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the address of the vault.
|
|
59
|
+
* @returns Promise resolving to the address of the vault
|
|
60
|
+
*/
|
|
61
|
+
getVaultAddress(): Promise<string>;
|
|
60
62
|
}
|
|
61
63
|
export type { Balance, TransactionResult } from "./responses";
|
|
62
64
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vault/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAM9D;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,OAAO;IACxC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vault/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAM9D;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,OAAO;IACxC;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEvF;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEvF;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExF;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5C;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/D;;;OAGG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACnC;AAGD,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -13,6 +13,8 @@ export interface TransactionResult {
|
|
|
13
13
|
status: "pending" | "confirmed" | "failed";
|
|
14
14
|
/** Nonce used for this operation */
|
|
15
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.
|
|
@@ -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"}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Websocket Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Fundamental definitions for Websocket connections, errors and events.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export interface BaseWebSocketEvent {
|
|
10
|
-
/** Event type identifier */
|
|
11
|
-
type: string;
|
|
12
|
-
/** Event timestamp (ISO string) */
|
|
13
|
-
timestamp: string;
|
|
14
|
-
/** Unique event ID */
|
|
15
|
-
eventId: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* WebSocket connection status
|
|
19
|
-
*/
|
|
20
|
-
export type ConnectionStatus = "connected" | "disconnected" | "connecting" | "reconnecting";
|
|
6
|
+
import type { OrderEvent } from "./orders-events";
|
|
7
|
+
import type { OHLCVEvent } from "./ohlcv-events";
|
|
21
8
|
/**
|
|
22
9
|
* WebSocket connection configuration
|
|
23
10
|
*/
|
|
@@ -44,9 +31,13 @@ export interface BaseErrorEvent {
|
|
|
44
31
|
details?: any;
|
|
45
32
|
}
|
|
46
33
|
/**
|
|
47
|
-
*
|
|
34
|
+
* WebSocket connection status
|
|
35
|
+
*/
|
|
36
|
+
export type ConnectionStatus = "connected" | "disconnected" | "connecting" | "reconnecting";
|
|
37
|
+
/**
|
|
38
|
+
* Base WebSocket client interface
|
|
48
39
|
*/
|
|
49
|
-
export interface
|
|
40
|
+
export interface BaseWebSocketClient {
|
|
50
41
|
/**
|
|
51
42
|
* Connect to the WebSocket server
|
|
52
43
|
* @returns Promise that resolves when connected
|
|
@@ -77,4 +68,44 @@ export interface WebSocketClient {
|
|
|
77
68
|
*/
|
|
78
69
|
send(data: any): void;
|
|
79
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Order-specific WebSocket client interface
|
|
73
|
+
*/
|
|
74
|
+
export interface OrdersWebSocketClient extends BaseWebSocketClient {
|
|
75
|
+
/**
|
|
76
|
+
* Subscribe to order events for a specific market and trading mode
|
|
77
|
+
* @param market - Trading pair symbol (e.g., 'BTC-USDC')
|
|
78
|
+
* @param tradingMode - Trading mode ('SPOT' or 'MARGIN')
|
|
79
|
+
* @param callback - Callback function for order events
|
|
80
|
+
*/
|
|
81
|
+
subscribeToOrderEvents(market: string, tradingMode: string, callback: (event: OrderEvent) => void): void;
|
|
82
|
+
/**
|
|
83
|
+
* Unsubscribe from order events for a specific market and trading mode
|
|
84
|
+
* @param market - Trading pair symbol
|
|
85
|
+
* @param tradingMode - Trading mode ('SPOT' or 'MARGIN')
|
|
86
|
+
*/
|
|
87
|
+
unsubscribeFromOrderEvents(market: string, tradingMode: string): void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* OHLCV data WebSocket client interface
|
|
91
|
+
*/
|
|
92
|
+
export interface OHLCVWebSocketClient extends BaseWebSocketClient {
|
|
93
|
+
/**
|
|
94
|
+
* Subscribe to OHLCV (candlestick) updates for a specific trading pair, mode, and interval
|
|
95
|
+
* @param symbol - Trading pair symbol (e.g., 'BTC-USDC')
|
|
96
|
+
* @param tradingMode - Trading mode ('SPOT' or 'MARGIN')
|
|
97
|
+
* @param interval - Candlestick interval (e.g., '1m', '5m', '1h', '1d')
|
|
98
|
+
* @param callback - Callback function for OHLCV events
|
|
99
|
+
*/
|
|
100
|
+
subscribeToOHLCV(symbol: string, tradingMode: string, interval: string, callback: (event: OHLCVEvent) => void): void;
|
|
101
|
+
/**
|
|
102
|
+
* Unsubscribe from OHLCV updates for a specific trading pair, mode, and interval
|
|
103
|
+
* @param symbol - Trading pair symbol
|
|
104
|
+
* @param tradingMode - Trading mode ('SPOT' or 'MARGIN')
|
|
105
|
+
* @param interval - Candlestick interval
|
|
106
|
+
*/
|
|
107
|
+
unsubscribeFromOHLCV(symbol: string, tradingMode: string, interval: string): void;
|
|
108
|
+
}
|
|
109
|
+
export * from "./orders-events";
|
|
110
|
+
export * from "./ohlcv-events";
|
|
80
111
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,U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UAAU,KAAK,IAAI,GACpC,IAAI,CAAC;IAER;;;;OAIG;IACH,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACvE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;;;;OAMG;IACH,gBAAgB,CACd,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GACpC,IAAI,CAAC;IAER;;;;;OAKG;IACH,oBAAoB,CAClB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,IAAI,CAAC;CACT;AAED,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
package/dist/websocket/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Websocket Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Fundamental definitions for Websocket connections, errors and events.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export * from "./orders-events";
|
|
7
|
+
export * from "./ohlcv-events";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwIH,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OHLCV WebSocket Event Types
|
|
3
|
+
*
|
|
4
|
+
* Types for OHLCV (Open, High, Low, Close, Volume) candlestick data events.
|
|
5
|
+
*/
|
|
6
|
+
import type { Candlestick, CandlestickInterval } from "../market";
|
|
7
|
+
import type { TradingMode } from "../trading";
|
|
8
|
+
/**
|
|
9
|
+
* OHLCV update event
|
|
10
|
+
*/
|
|
11
|
+
export interface OHLCVEvent {
|
|
12
|
+
/** Trading pair symbol */
|
|
13
|
+
symbol: string;
|
|
14
|
+
/** Candlestick interval */
|
|
15
|
+
interval: CandlestickInterval;
|
|
16
|
+
/** Trading mode */
|
|
17
|
+
tradingMode: TradingMode;
|
|
18
|
+
/** OHLCV candlestick data */
|
|
19
|
+
candlestick: Candlestick;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* OHLCV subscription configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface OHLCVSubscriptionConfig {
|
|
25
|
+
/** Trading pair symbol */
|
|
26
|
+
symbol: string;
|
|
27
|
+
/** Trading mode */
|
|
28
|
+
tradingMode: TradingMode;
|
|
29
|
+
/** Candlestick interval */
|
|
30
|
+
interval: CandlestickInterval;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ohlcv-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ohlcv-events.d.ts","sourceRoot":"","sources":["../../src/websocket/ohlcv-events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,mBAAmB;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,6BAA6B;IAC7B,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,2BAA2B;IAC3B,QAAQ,EAAE,mBAAmB,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ohlcv-events.js","sourceRoot":"","sources":["../../src/websocket/ohlcv-events.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orders WebSocket Event Types
|
|
3
|
+
*
|
|
4
|
+
* Event interfaces for real-time order WebSocket communications
|
|
5
|
+
*/
|
|
6
|
+
import { OrderSide, OrderType, TradingMode } from "../trading";
|
|
7
|
+
/**
|
|
8
|
+
* Order event types
|
|
9
|
+
*/
|
|
10
|
+
export type OrderEventType = "OrderPlaced" | "OrderMatched" | "OrderPartiallyFilled" | "OrderFilled" | "OrderCancelled" | "OrderRejected" | "OrderReplaced" | "OrderExpired";
|
|
11
|
+
/**
|
|
12
|
+
* Order event interface with camelCase properties
|
|
13
|
+
*/
|
|
14
|
+
export interface OrderEvent {
|
|
15
|
+
/** Order ID */
|
|
16
|
+
orderId: string;
|
|
17
|
+
/** Event type */
|
|
18
|
+
eventType: OrderEventType;
|
|
19
|
+
/** Event details */
|
|
20
|
+
details: {
|
|
21
|
+
/** Application ID */
|
|
22
|
+
applicationId?: string;
|
|
23
|
+
/** Order type */
|
|
24
|
+
orderType?: OrderType;
|
|
25
|
+
/** Price */
|
|
26
|
+
price?: string;
|
|
27
|
+
/** Quantity */
|
|
28
|
+
quantity?: string;
|
|
29
|
+
/** Side */
|
|
30
|
+
side?: OrderSide;
|
|
31
|
+
/** Trading mode */
|
|
32
|
+
tradingMode?: TradingMode;
|
|
33
|
+
/** Trading pair */
|
|
34
|
+
tradingPair?: string;
|
|
35
|
+
/** Trading pair ID */
|
|
36
|
+
tradingPairId?: string;
|
|
37
|
+
/** User ID */
|
|
38
|
+
userId: string;
|
|
39
|
+
/** Cancelled at */
|
|
40
|
+
cancelledAt?: string;
|
|
41
|
+
/** Filled quantity */
|
|
42
|
+
filledQuantity?: string;
|
|
43
|
+
/** Remaining quantity */
|
|
44
|
+
remainingQuantity?: string;
|
|
45
|
+
/** Reason */
|
|
46
|
+
reason?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Subscription configuration for order events
|
|
51
|
+
*/
|
|
52
|
+
export interface OrderSubscriptionConfig {
|
|
53
|
+
eventTypes: OrderEventType[];
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=orders-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders-events.d.ts","sourceRoot":"","sources":["../../src/websocket/orders-events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE/D;;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,eAAe;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,EAAE,cAAc,CAAC;IAC1B,oBAAoB;IACpB,OAAO,EAAE;QACP,qBAAqB;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,iBAAiB;QACjB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,YAAY;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW;QACX,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,mBAAmB;QACnB,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,mBAAmB;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,sBAAsB;QACtB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc;QACd,MAAM,EAAE,MAAM,CAAC;QACf,mBAAmB;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,sBAAsB;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,yBAAyB;QACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,aAAa;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,cAAc,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders-events.js","sourceRoot":"","sources":["../../src/websocket/orders-events.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|