@0xmonaco/types 0.0.0-develop-20260120180031
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 +391 -0
- package/dist/api/index.d.ts +19 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- 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 +76 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/responses.d.ts +68 -0
- package/dist/auth/responses.d.ts.map +1 -0
- package/dist/auth/responses.js +7 -0
- package/dist/auth/responses.js.map +1 -0
- package/dist/contracts/balances.d.ts +44 -0
- package/dist/contracts/balances.d.ts.map +1 -0
- package/dist/contracts/balances.js +7 -0
- package/dist/contracts/balances.js.map +1 -0
- package/dist/contracts/index.d.ts +28 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +7 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/fees/index.d.ts +40 -0
- package/dist/fees/index.d.ts.map +1 -0
- package/dist/fees/index.js +7 -0
- package/dist/fees/index.js.map +1 -0
- package/dist/fees/responses.d.ts +47 -0
- package/dist/fees/responses.d.ts.map +1 -0
- package/dist/fees/responses.js +62 -0
- package/dist/fees/responses.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/market/index.d.ts +224 -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/profile/index.d.ts +228 -0
- package/dist/profile/index.d.ts.map +1 -0
- package/dist/profile/index.js +7 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/sdk/index.d.ts +122 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/network.d.ts +31 -0
- package/dist/sdk/network.d.ts.map +1 -0
- package/dist/sdk/network.js +7 -0
- package/dist/sdk/network.js.map +1 -0
- package/dist/trading/index.d.ts +88 -0
- package/dist/trading/index.d.ts.map +1 -0
- package/dist/trading/index.js +7 -0
- package/dist/trading/index.js.map +1 -0
- package/dist/trading/orders.d.ts +108 -0
- package/dist/trading/orders.d.ts.map +1 -0
- package/dist/trading/orders.js +7 -0
- package/dist/trading/orders.js.map +1 -0
- package/dist/trading/responses.d.ts +130 -0
- package/dist/trading/responses.d.ts.map +1 -0
- package/dist/trading/responses.js +7 -0
- package/dist/trading/responses.js.map +1 -0
- package/dist/validation/common.d.ts +181 -0
- package/dist/validation/common.d.ts.map +1 -0
- package/dist/validation/common.js +196 -0
- package/dist/validation/common.js.map +1 -0
- package/dist/validation/index.d.ts +20 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +22 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/market.d.ts +215 -0
- package/dist/validation/market.d.ts.map +1 -0
- package/dist/validation/market.js +226 -0
- package/dist/validation/market.js.map +1 -0
- package/dist/validation/trading.d.ts +148 -0
- package/dist/validation/trading.d.ts.map +1 -0
- package/dist/validation/trading.js +139 -0
- package/dist/validation/trading.js.map +1 -0
- package/dist/validation/vault.d.ts +62 -0
- package/dist/validation/vault.d.ts.map +1 -0
- package/dist/validation/vault.js +75 -0
- package/dist/validation/vault.js.map +1 -0
- package/dist/vault/index.d.ts +64 -0
- package/dist/vault/index.d.ts.map +1 -0
- package/dist/vault/index.js +7 -0
- package/dist/vault/index.js.map +1 -0
- package/dist/vault/responses.d.ts +34 -0
- package/dist/vault/responses.d.ts.map +1 -0
- package/dist/vault/responses.js +7 -0
- package/dist/vault/responses.js.map +1 -0
- package/dist/websocket/base.d.ts +32 -0
- package/dist/websocket/base.d.ts.map +1 -0
- package/dist/websocket/base.js +7 -0
- package/dist/websocket/base.js.map +1 -0
- package/dist/websocket/clients/orderbook-client.d.ts +15 -0
- package/dist/websocket/clients/orderbook-client.d.ts.map +1 -0
- package/dist/websocket/clients/orderbook-client.js +5 -0
- package/dist/websocket/clients/orderbook-client.js.map +1 -0
- package/dist/websocket/events/index.d.ts +6 -0
- package/dist/websocket/events/index.d.ts.map +1 -0
- package/dist/websocket/events/index.js +6 -0
- package/dist/websocket/events/index.js.map +1 -0
- package/dist/websocket/events/movement-events.d.ts +53 -0
- package/dist/websocket/events/movement-events.d.ts.map +1 -0
- package/dist/websocket/events/movement-events.js +8 -0
- package/dist/websocket/events/movement-events.js.map +1 -0
- package/dist/websocket/events/ohlcv-events.d.ts +32 -0
- package/dist/websocket/events/ohlcv-events.d.ts.map +1 -0
- package/dist/websocket/events/ohlcv-events.js +7 -0
- package/dist/websocket/events/ohlcv-events.js.map +1 -0
- package/dist/websocket/events/orderbook-events.d.ts +73 -0
- package/dist/websocket/events/orderbook-events.d.ts.map +1 -0
- package/dist/websocket/events/orderbook-events.js +7 -0
- package/dist/websocket/events/orderbook-events.js.map +1 -0
- package/dist/websocket/events/orders-events.d.ts +285 -0
- package/dist/websocket/events/orders-events.d.ts.map +1 -0
- package/dist/websocket/events/orders-events.js +2 -0
- package/dist/websocket/events/orders-events.js.map +1 -0
- package/dist/websocket/events/trade-events.d.ts +35 -0
- package/dist/websocket/events/trade-events.d.ts.map +1 -0
- package/dist/websocket/events/trade-events.js +7 -0
- package/dist/websocket/events/trade-events.js.map +1 -0
- package/dist/websocket/index.d.ts +9 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/index.js +9 -0
- package/dist/websocket/index.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile Types
|
|
3
|
+
*
|
|
4
|
+
* Types for user profile operations including fetching user profile data.
|
|
5
|
+
*/
|
|
6
|
+
import type { BaseAPI } from "../api";
|
|
7
|
+
import type { OrderSide, OrderStatus, OrderType, TimeInForce } from "../trading";
|
|
8
|
+
/**
|
|
9
|
+
* Account movement/transaction information.
|
|
10
|
+
* Represents transactions/movements returned in the profile's recent_movements array.
|
|
11
|
+
*/
|
|
12
|
+
export interface ProfileMovement {
|
|
13
|
+
/** Movement identifier */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Movement type */
|
|
16
|
+
type: "deposit" | "withdrawal" | "trade" | "transfer" | string;
|
|
17
|
+
/** Token address */
|
|
18
|
+
token: string;
|
|
19
|
+
/** Amount of the movement (as string to preserve precision) */
|
|
20
|
+
amount: string;
|
|
21
|
+
/** Movement timestamp (ISO string) */
|
|
22
|
+
timestamp: string;
|
|
23
|
+
/** Transaction hash if applicable */
|
|
24
|
+
hash?: string;
|
|
25
|
+
/** Movement status */
|
|
26
|
+
status: "pending" | "confirmed" | "failed" | string;
|
|
27
|
+
/** Optional description of the movement */
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Ledger movement from the movement's endpoint.
|
|
32
|
+
* More detailed than ProfileMovement with balance tracking.
|
|
33
|
+
*/
|
|
34
|
+
export interface LedgerMovement {
|
|
35
|
+
/** Movement unique identifier */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Type of entry (Credit, Debit) */
|
|
38
|
+
entry_type: string;
|
|
39
|
+
/** Type of transaction (Deposit, Withdrawal, Trade, etc.) */
|
|
40
|
+
transaction_type: string;
|
|
41
|
+
/** Transaction amount */
|
|
42
|
+
amount: string;
|
|
43
|
+
/** Token symbol */
|
|
44
|
+
token: string;
|
|
45
|
+
/** Balance before this transaction */
|
|
46
|
+
balance_before: string | null;
|
|
47
|
+
/** Balance after this transaction */
|
|
48
|
+
balance_after: string | null;
|
|
49
|
+
/** Locked balance before transaction */
|
|
50
|
+
locked_before: string | null;
|
|
51
|
+
/** Locked balance after transaction */
|
|
52
|
+
locked_after: string | null;
|
|
53
|
+
/** Reference identifier for related operations */
|
|
54
|
+
reference_id: string | null;
|
|
55
|
+
/** Reference type */
|
|
56
|
+
reference_type: string | null;
|
|
57
|
+
/** Human readable description */
|
|
58
|
+
description: string | null;
|
|
59
|
+
/** Blockchain transaction hash */
|
|
60
|
+
tx_hash: string | null;
|
|
61
|
+
/** Blockchain block number */
|
|
62
|
+
block_number: number | null;
|
|
63
|
+
/** Transaction timestamp */
|
|
64
|
+
created_at: string | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Query parameters for getting user movements
|
|
68
|
+
*/
|
|
69
|
+
export interface GetUserMovementsParams {
|
|
70
|
+
/** Page number (starts from 1) */
|
|
71
|
+
page?: number;
|
|
72
|
+
/** Number of items per page (max 100) */
|
|
73
|
+
limit?: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Query parameters for getting user balances
|
|
77
|
+
*/
|
|
78
|
+
export interface GetUserBalancesParams {
|
|
79
|
+
/** Number of items to return */
|
|
80
|
+
limit?: number;
|
|
81
|
+
/** Number of items to skip */
|
|
82
|
+
offset?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Response from getting user movements
|
|
86
|
+
*/
|
|
87
|
+
export interface GetPaginatedUserMovementsResponse {
|
|
88
|
+
/** List of ledger movements */
|
|
89
|
+
movements: LedgerMovement[];
|
|
90
|
+
/** Current page number */
|
|
91
|
+
page: number;
|
|
92
|
+
/** Items per page */
|
|
93
|
+
limit: number;
|
|
94
|
+
/** Total number of movements */
|
|
95
|
+
total_count: number;
|
|
96
|
+
/** Total number of pages */
|
|
97
|
+
total_pages: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Response from getting user balances
|
|
101
|
+
*/
|
|
102
|
+
export interface GetUserBalancesResponse {
|
|
103
|
+
/** List of token balances for the user */
|
|
104
|
+
balances: AccountBalance[];
|
|
105
|
+
/** Total number of balances */
|
|
106
|
+
total: number;
|
|
107
|
+
/** Number of items returned */
|
|
108
|
+
limit: number;
|
|
109
|
+
/** Number of items skipped */
|
|
110
|
+
offset: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Order information for recent orders.
|
|
114
|
+
* Represents orders returned in the profile's recent_orders array.
|
|
115
|
+
*/
|
|
116
|
+
export interface ProfileOrder {
|
|
117
|
+
/** Order identifier */
|
|
118
|
+
id: string;
|
|
119
|
+
/** Trading pair/market identifier (e.g., "ETH-USD") */
|
|
120
|
+
trading_pair: string;
|
|
121
|
+
/** Order side */
|
|
122
|
+
side: OrderSide;
|
|
123
|
+
/** Order type */
|
|
124
|
+
order_type: OrderType;
|
|
125
|
+
/** Order price (null for market orders) */
|
|
126
|
+
price: string | null;
|
|
127
|
+
/** Order quantity */
|
|
128
|
+
quantity: string;
|
|
129
|
+
/** Order status */
|
|
130
|
+
status: OrderStatus;
|
|
131
|
+
/** Time in force */
|
|
132
|
+
time_in_force?: TimeInForce;
|
|
133
|
+
/** Order creation timestamp (ISO string) */
|
|
134
|
+
created_at: string;
|
|
135
|
+
/** Order last update timestamp (ISO string) */
|
|
136
|
+
updated_at?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Account balance for a specific token.
|
|
140
|
+
* Returned by the single balance lookup endpoint.
|
|
141
|
+
*/
|
|
142
|
+
export interface AccountBalance {
|
|
143
|
+
/** Token address */
|
|
144
|
+
token: string;
|
|
145
|
+
/** Token symbol */
|
|
146
|
+
symbol: string;
|
|
147
|
+
/** Decimal places for the token */
|
|
148
|
+
decimals: number;
|
|
149
|
+
/** Available balance for trading */
|
|
150
|
+
available_balance: string;
|
|
151
|
+
/** Locked balance (in orders or pending operations) */
|
|
152
|
+
locked_balance: string;
|
|
153
|
+
/** Total balance (available + locked) */
|
|
154
|
+
total_balance: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* User profile information returned by the /api/v1/accounts/me endpoint.
|
|
158
|
+
*/
|
|
159
|
+
export interface UserProfile {
|
|
160
|
+
/** Unique identifier for the user */
|
|
161
|
+
id: string;
|
|
162
|
+
/** Wallet address of the user */
|
|
163
|
+
address: string;
|
|
164
|
+
/** Username of the user (can be null) */
|
|
165
|
+
username: string | null;
|
|
166
|
+
/** Account type (e.g., "master") */
|
|
167
|
+
account_type: string;
|
|
168
|
+
/** Whether the user can withdraw funds */
|
|
169
|
+
can_withdraw: boolean;
|
|
170
|
+
/** Account creation timestamp (ISO string) */
|
|
171
|
+
created_at: string;
|
|
172
|
+
/** User's current balances */
|
|
173
|
+
balances: AccountBalance[];
|
|
174
|
+
/** Recent account movements/transactions */
|
|
175
|
+
recent_movements: ProfileMovement[];
|
|
176
|
+
/** Recent trading orders */
|
|
177
|
+
recent_orders: ProfileOrder[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Profile API interface.
|
|
181
|
+
* Provides methods for fetching and managing user profile information.
|
|
182
|
+
*/
|
|
183
|
+
export interface ProfileAPI extends BaseAPI {
|
|
184
|
+
/**
|
|
185
|
+
* Get the current user's profile information.
|
|
186
|
+
*
|
|
187
|
+
* Fetches the profile data for the authenticated user using the /api/v1/accounts/me endpoint.
|
|
188
|
+
* Requires a valid access token to be set.
|
|
189
|
+
*
|
|
190
|
+
* @returns Promise resolving to the user's profile information
|
|
191
|
+
*/
|
|
192
|
+
getProfile(): Promise<UserProfile>;
|
|
193
|
+
/**
|
|
194
|
+
* Get the current user's ledger movements (transaction history) with pagination.
|
|
195
|
+
*
|
|
196
|
+
* Fetches the user's transaction history from the /api/v1/accounts/movements endpoint.
|
|
197
|
+
* Requires a valid access token to be set.
|
|
198
|
+
*
|
|
199
|
+
* @param params - Optional query parameters for pagination
|
|
200
|
+
* @param params.page - Page number (starts from 1)
|
|
201
|
+
* @param params.limit - Number of items per page (max 100)
|
|
202
|
+
* @returns Promise resolving to paginated movements response
|
|
203
|
+
*/
|
|
204
|
+
getPaginatedUserMovements(params?: GetUserMovementsParams): Promise<GetPaginatedUserMovementsResponse>;
|
|
205
|
+
/**
|
|
206
|
+
* Get the current user's token balances with pagination.
|
|
207
|
+
*
|
|
208
|
+
* Fetches the user's token balances from the /api/v1/accounts/balances endpoint.
|
|
209
|
+
* Requires a valid access token to be set.
|
|
210
|
+
*
|
|
211
|
+
* @param params - Optional query parameters for pagination
|
|
212
|
+
* @param params.limit - Number of items to return
|
|
213
|
+
* @param params.offset - Number of items to skip
|
|
214
|
+
* @returns Promise resolving to paginated balances response
|
|
215
|
+
*/
|
|
216
|
+
getUserBalances(params?: GetUserBalancesParams): Promise<GetUserBalancesResponse>;
|
|
217
|
+
/**
|
|
218
|
+
* Get the current user's balance for a specific asset.
|
|
219
|
+
*
|
|
220
|
+
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{asset_id} endpoint.
|
|
221
|
+
* Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
|
|
222
|
+
*
|
|
223
|
+
* @param assetId - The asset identifier (UUID)
|
|
224
|
+
* @returns Promise resolving to the account balance for the asset
|
|
225
|
+
*/
|
|
226
|
+
getUserBalanceByAssetId(assetId: string): Promise<AccountBalance>;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/profile/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,IAAI,EAAE,SAAS,GAAG,YAA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EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/profile/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { PublicClient, TransactionReceipt, WalletClient } from "viem";
|
|
2
|
+
import type { ApplicationsAPI } from "../applications";
|
|
3
|
+
import type { AuthAPI, AuthState } from "../auth/index";
|
|
4
|
+
import type { FeesAPI } from "../fees";
|
|
5
|
+
import type { Interval, MarketAPI } from "../market";
|
|
6
|
+
import type { ProfileAPI } from "../profile";
|
|
7
|
+
import type { TradingAPI, TradingMode } from "../trading";
|
|
8
|
+
import type { VaultAPI } from "../vault";
|
|
9
|
+
import type { OHLCVEvent, OrderbookEvent, OrderbookQuotationMode, OrderEvent, TradeEvent, UserMovementEvent } from "../websocket";
|
|
10
|
+
import type { Network } from "./network";
|
|
11
|
+
/**
|
|
12
|
+
* Configuration options for the Monaco SDK.
|
|
13
|
+
*
|
|
14
|
+
* The SDK requires a wallet client for signing operations and an RPC URL.
|
|
15
|
+
*/
|
|
16
|
+
export interface SDKConfig {
|
|
17
|
+
/** Wallet client for signing operations */
|
|
18
|
+
walletClient: WalletClient;
|
|
19
|
+
/**
|
|
20
|
+
* Network to use - can be a preset ("local", "development", "staging", "mainnet") or a custom API URL.
|
|
21
|
+
*
|
|
22
|
+
* Preset networks map to default API URLs:
|
|
23
|
+
* - "local": http://localhost:8080
|
|
24
|
+
* - "development": https://develop.apimonaco.xyz
|
|
25
|
+
* - "staging": https://staging.apimonaco.xyz
|
|
26
|
+
* - "mainnet": https://api.monaco.xyz
|
|
27
|
+
*
|
|
28
|
+
* For custom API URLs, pass the full URL as a string (e.g., "https://my-custom-monaco-api.com").
|
|
29
|
+
* Note: Custom API URLs always use the testnet chain (Sei testnet). Only the "mainnet" preset uses the mainnet chain.
|
|
30
|
+
*/
|
|
31
|
+
network: Network;
|
|
32
|
+
/** RPC URL for Sei blockchain interactions (required) */
|
|
33
|
+
seiRpcUrl: string;
|
|
34
|
+
/** Websocket URL for Monaco */
|
|
35
|
+
wsUrl: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Core SDK interface providing access to all Monaco functionality.
|
|
39
|
+
*/
|
|
40
|
+
export interface MonacoSDK {
|
|
41
|
+
/** Applications operations API */
|
|
42
|
+
applications: ApplicationsAPI;
|
|
43
|
+
/** Auth operations API */
|
|
44
|
+
auth: AuthAPI;
|
|
45
|
+
/** Fees operations API */
|
|
46
|
+
fees: FeesAPI;
|
|
47
|
+
/** Vault operations API */
|
|
48
|
+
vault: VaultAPI;
|
|
49
|
+
/** Trading operations API */
|
|
50
|
+
trading: TradingAPI;
|
|
51
|
+
/** Market metadata API */
|
|
52
|
+
market: MarketAPI;
|
|
53
|
+
/** Profile operations API */
|
|
54
|
+
profile: ProfileAPI;
|
|
55
|
+
/** Orderbook REST API for fetching orderbook snapshots */
|
|
56
|
+
orderbook: {
|
|
57
|
+
getOrderbook: (tradingPairId: string, options?: {
|
|
58
|
+
/** Number of price levels to return (max 100). Defaults to 10. */
|
|
59
|
+
depth?: number;
|
|
60
|
+
/** Trading mode: 'Spot' or 'Margin'. Defaults to 'Spot'. */
|
|
61
|
+
tradingMode?: TradingMode;
|
|
62
|
+
/** Price grouping magnitude. Valid values: 0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000. */
|
|
63
|
+
magnitude?: number;
|
|
64
|
+
/** Quantity denomination: 'BASE' or 'QUOTE'. When 'QUOTE' type, quantities are multiplied by the quote price. */
|
|
65
|
+
denomination?: OrderbookQuotationMode;
|
|
66
|
+
}) => Promise<OrderbookEvent>;
|
|
67
|
+
};
|
|
68
|
+
/** Trades REST API for fetching historical trades */
|
|
69
|
+
trades: {
|
|
70
|
+
getTrades: (tradingPairId: string, options?: {
|
|
71
|
+
/** Number of records to skip (default: 0) */
|
|
72
|
+
skip?: number;
|
|
73
|
+
/** Maximum number of records to return (default: 25, max: 100) */
|
|
74
|
+
limit?: number;
|
|
75
|
+
}) => Promise<TradeEvent[]>;
|
|
76
|
+
};
|
|
77
|
+
/** WebSocket client for real-time data (orders, orderbook, ohlcv) */
|
|
78
|
+
ws: {
|
|
79
|
+
connect: () => Promise<void>;
|
|
80
|
+
disconnect: () => void;
|
|
81
|
+
isConnected: () => boolean;
|
|
82
|
+
getStatus: () => "connected" | "connecting" | "disconnected" | "reconnecting";
|
|
83
|
+
setToken: (token: string) => void;
|
|
84
|
+
orders: (tradingPairId: string, tradingMode: TradingMode, handler: (event: OrderEvent) => void) => () => void;
|
|
85
|
+
orderbook: (tradingPairId: string, tradingMode: TradingMode, magnitude: number, quotationMode: OrderbookQuotationMode, handler: (event: OrderbookEvent) => void) => () => void;
|
|
86
|
+
ohlcv: (tradingPairId: string, tradingMode: TradingMode, interval: Interval, handler: (event: OHLCVEvent) => void) => () => void;
|
|
87
|
+
trades: (tradingPairId: string, handler: (event: TradeEvent) => void) => () => void;
|
|
88
|
+
movements: (handler: (event: UserMovementEvent) => void) => () => void;
|
|
89
|
+
};
|
|
90
|
+
/** Wallet client for all blockchain operations */
|
|
91
|
+
walletClient: WalletClient;
|
|
92
|
+
/** Public client for read-only blockchain operations */
|
|
93
|
+
publicClient: PublicClient;
|
|
94
|
+
/**
|
|
95
|
+
* Complete authentication flow
|
|
96
|
+
* @param clientId - The client ID for authentication
|
|
97
|
+
* @param options - Optional configuration for login
|
|
98
|
+
*/
|
|
99
|
+
login(clientId: string, options?: {
|
|
100
|
+
connectWebSocket?: boolean;
|
|
101
|
+
}): Promise<AuthState>;
|
|
102
|
+
/** Log out the user */
|
|
103
|
+
logout(): Promise<void>;
|
|
104
|
+
/** Refresh the access token */
|
|
105
|
+
refreshAuth(): Promise<AuthState>;
|
|
106
|
+
/** Get the current authentication state */
|
|
107
|
+
getAuthState(): AuthState | undefined;
|
|
108
|
+
/** Check if the user is authenticated */
|
|
109
|
+
isAuthenticated(): boolean;
|
|
110
|
+
/** Check connection status */
|
|
111
|
+
isConnected(): boolean;
|
|
112
|
+
/** Get the current account address */
|
|
113
|
+
getAccountAddress(): string;
|
|
114
|
+
/** Get the current network ('mainnet' or 'testnet') */
|
|
115
|
+
getNetwork(): Network;
|
|
116
|
+
/** Get the current chain ID */
|
|
117
|
+
getChainId(): number;
|
|
118
|
+
/** Wait for a transaction to be confirmed */
|
|
119
|
+
waitForTransaction(hash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
|
|
120
|
+
}
|
|
121
|
+
export type { Network, NetworkEndpoints } from "./network";
|
|
122
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,MA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AAC;IAEtF,uBAAuB;IACvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB,+BAA+B;IAC/B,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAElC,2CAA2C;IAC3C,YAAY,IAAI,SAAS,GAAG,SAAS,CAAC;IAEtC,yCAAyC;IACzC,eAAe,IAAI,OAAO,CAAC;IAE3B,8BAA8B;IAC9B,WAAW,IAAI,OAAO,CAAC;IAEvB,sCAAsC;IACtC,iBAAiB,IAAI,MAAM,CAAC;IAE5B,uDAAuD;IACvD,UAAU,IAAI,OAAO,CAAC;IAEtB,+BAA+B;IAC/B,UAAU,IAAI,MAAM,CAAC;IAErB,6CAA6C;IAC7C,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACzG;AAGD,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network Types
|
|
3
|
+
*
|
|
4
|
+
* Network configuration and endpoint types for the Monaco SDK.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Supported network types for the Monaco SDK.
|
|
8
|
+
*
|
|
9
|
+
* Can be one of the preset networks ("mainnet", "development", "staging", "local") which map to default API URLs,
|
|
10
|
+
* or a custom API URL string that will be used directly.
|
|
11
|
+
*
|
|
12
|
+
* Preset API URLs:
|
|
13
|
+
* - "local": http://localhost:8080
|
|
14
|
+
* - "development": https://develop.apimonaco.xyz
|
|
15
|
+
* - "staging": https://staging.apimonaco.xyz
|
|
16
|
+
* - "mainnet": https://api.monaco.xyz
|
|
17
|
+
*
|
|
18
|
+
* Custom API URL example: "https://my-custom-api.com"
|
|
19
|
+
*/
|
|
20
|
+
export type Network = "mainnet" | "development" | "staging" | "local" | string;
|
|
21
|
+
/**
|
|
22
|
+
* Network endpoint configuration for the Monaco SDK.
|
|
23
|
+
*
|
|
24
|
+
* Contains the RPC URL and API URL for each supported network.
|
|
25
|
+
* WebSocket connections use the API URL with /ws endpoint and the access token is passed as a query parameter.
|
|
26
|
+
*/
|
|
27
|
+
export interface NetworkEndpoints {
|
|
28
|
+
rpcUrl: string;
|
|
29
|
+
apiUrl: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/sdk/network.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/sdk/network.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trading Types
|
|
3
|
+
*
|
|
4
|
+
* Types for trading operations including order placement and management.
|
|
5
|
+
*/
|
|
6
|
+
import type { BaseAPI } from "../api/index";
|
|
7
|
+
import type { OrderSide, TimeInForce, TradingMode } from "./orders";
|
|
8
|
+
import type { CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ReplaceOrderResponse } from "./responses";
|
|
9
|
+
/**
|
|
10
|
+
* Trading API interface.
|
|
11
|
+
* Provides methods for placing and managing orders.
|
|
12
|
+
* Handles order placement, cancellation, and execution.
|
|
13
|
+
*/
|
|
14
|
+
export interface TradingAPI extends BaseAPI {
|
|
15
|
+
/**
|
|
16
|
+
* Places a limit order on the order book.
|
|
17
|
+
* @param tradingPairId - Trading pair UUID
|
|
18
|
+
* @param side - Order side ("BUY" or "SELL")
|
|
19
|
+
* @param quantity - Order quantity as string
|
|
20
|
+
* @param price - Order price as string
|
|
21
|
+
* @param options - Optional parameters for the limit order
|
|
22
|
+
* @param options.tradingMode - Trading mode (e.g., "SPOT")
|
|
23
|
+
* @param options.timeInForce - Time in force ("GTC", "IOC", or "FOK")
|
|
24
|
+
* @returns Promise resolving to the order result
|
|
25
|
+
*/
|
|
26
|
+
placeLimitOrder(tradingPairId: string, side: OrderSide, quantity: string, price: string, options?: {
|
|
27
|
+
tradingMode?: TradingMode;
|
|
28
|
+
useMasterBalance?: boolean;
|
|
29
|
+
expirationDate?: string;
|
|
30
|
+
timeInForce?: TimeInForce;
|
|
31
|
+
}): Promise<CreateOrderResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Places a market order for immediate execution.
|
|
34
|
+
* @param tradingPairId - Trading pair UUID
|
|
35
|
+
* @param side - Order side ("BUY" or "SELL")
|
|
36
|
+
* @param quantity - Order quantity as string
|
|
37
|
+
* @param options - Optional parameters for the market order
|
|
38
|
+
* @param options.tradingMode - Trading mode (e.g., "SPOT")
|
|
39
|
+
* @param options.slippageTolerance - Slippage tolerance as decimal (e.g., 0.01 for 1%, 0 for best price only, undefined for unlimited slippage)
|
|
40
|
+
* @param options.timeInForce - Time in force ("GTC", "IOC", or "FOK")
|
|
41
|
+
* @returns Promise resolving to the order result
|
|
42
|
+
*/
|
|
43
|
+
placeMarketOrder(tradingPairId: string, side: OrderSide, quantity: string, options?: {
|
|
44
|
+
tradingMode?: TradingMode;
|
|
45
|
+
slippageTolerance?: number;
|
|
46
|
+
timeInForce?: TimeInForce;
|
|
47
|
+
}): Promise<CreateOrderResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Cancels an existing order.
|
|
50
|
+
* @param orderId - ID of the order to cancel
|
|
51
|
+
* @returns Promise resolving to the cancellation result
|
|
52
|
+
*/
|
|
53
|
+
cancelOrder(orderId: string): Promise<CancelOrderResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Replaces an existing order with new parameters.
|
|
56
|
+
* Updates the order with new price, quantity, and balance settings.
|
|
57
|
+
* @param orderId - ID of the order to replace
|
|
58
|
+
* @param newOrder - New order parameters
|
|
59
|
+
* @param newOrder.price - New order price as string (optional)
|
|
60
|
+
* @param newOrder.quantity - New order quantity as string
|
|
61
|
+
* @param newOrder.useMasterBalance - Whether to use master balance (optional, defaults to false)
|
|
62
|
+
* @returns Promise resolving to the replace result
|
|
63
|
+
*/
|
|
64
|
+
replaceOrder(orderId: string, newOrder: {
|
|
65
|
+
price?: string;
|
|
66
|
+
quantity?: string;
|
|
67
|
+
useMasterBalance?: boolean;
|
|
68
|
+
}): Promise<ReplaceOrderResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets paginated orders based on query parameters.
|
|
71
|
+
* @param params - Query parameters for filtering orders
|
|
72
|
+
* @param params.status - Filter by order status (optional)
|
|
73
|
+
* @param params.trading_pair - Filter by trading pair (optional)
|
|
74
|
+
* @param params.page - Page number for pagination (optional)
|
|
75
|
+
* @param params.page_size - Number of orders per page (optional)
|
|
76
|
+
* @returns Promise resolving to the paginated orders result
|
|
77
|
+
*/
|
|
78
|
+
getPaginatedOrders(params?: GetPaginatedOrdersParams): Promise<GetPaginatedOrdersResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Gets a single order by its ID.
|
|
81
|
+
* @param orderId - ID of the order to retrieve
|
|
82
|
+
* @returns Promise resolving to the order details
|
|
83
|
+
*/
|
|
84
|
+
getOrder(orderId: string): Promise<GetOrderResponse>;
|
|
85
|
+
}
|
|
86
|
+
export type { Order, OrderRole, OrderSide, OrderStatus, OrderType, TimeInForce, TradingMode, } from "./orders";
|
|
87
|
+
export type { CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, MatchResult, ReplaceOrderResponse, UpdatedFields, } from "./responses";
|
|
88
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trading/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,OAAO;IACzC;;;;;;;;;;OAUG;IACH,eAAe,CACb,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,GACA,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;;;;;;;OAUG;IACH,gBAAgB,CACd,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,GACA,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE3D;;;;;;;;;OASG;IACH,YAAY,CACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,GACA,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;OAQG;IACH,kBAAkB,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAE3F;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACtD;AAGD,YAAY,EACV,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,GACZ,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,WAAW,EACX,oBAAoB,EACpB,aAAa,GACd,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/trading/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trading Order Types
|
|
3
|
+
*
|
|
4
|
+
* Types for trading operations and order management.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard order structure used across all order-related responses.
|
|
8
|
+
* This represents the complete order information as returned by the API.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Order lifecycle statuses: PENDING → SUBMITTED → ACKNOWLEDGED → (PARTIALLY_FILLED) → FILLED
|
|
12
|
+
* Orders can transition to CANCELLED, REJECTED, or EXPIRED at various stages.
|
|
13
|
+
* Fee fields are only populated after order fills occur.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* To calculate remaining quantity:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const remaining = parseFloat(order.quantity) - parseFloat(order.filled_quantity);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface Order {
|
|
22
|
+
/** Order identifier (UUID) */
|
|
23
|
+
id: string;
|
|
24
|
+
/** Trading pair ID (UUID format, e.g., "456e7890-e12b-12d3-a456-426614174000") */
|
|
25
|
+
trading_pair: string;
|
|
26
|
+
/** Order side (BUY or SELL) */
|
|
27
|
+
side: OrderSide;
|
|
28
|
+
/** Order type - see OrderType for all supported types */
|
|
29
|
+
order_type: OrderType;
|
|
30
|
+
/** Order status - see OrderStatus for lifecycle details */
|
|
31
|
+
status: OrderStatus;
|
|
32
|
+
/** Order price - null for market orders, required for limit orders */
|
|
33
|
+
price?: string;
|
|
34
|
+
/** Order quantity (base currency amount) */
|
|
35
|
+
quantity: string;
|
|
36
|
+
/** Filled quantity (base currency amount, "0" if unfilled) */
|
|
37
|
+
filled_quantity: string;
|
|
38
|
+
/** Average fill price - only populated after order has fills */
|
|
39
|
+
average_fill_price?: string;
|
|
40
|
+
/** Trading mode (SPOT or MARGIN) */
|
|
41
|
+
trading_mode: TradingMode;
|
|
42
|
+
/** Time in force - GTC, IOC, FOK, or GTD */
|
|
43
|
+
time_in_force?: TimeInForce;
|
|
44
|
+
/** Order creation timestamp (ISO 8601) */
|
|
45
|
+
created_at: string;
|
|
46
|
+
/** Order last update timestamp (ISO 8601) */
|
|
47
|
+
updated_at?: string;
|
|
48
|
+
/** Optional expiration date for GTD orders (ISO 8601, max 1 year) */
|
|
49
|
+
expiration_date?: string;
|
|
50
|
+
/** Application taker fee in basis points (e.g., "100" = 1%) - populated after fills */
|
|
51
|
+
application_taker_fee?: string;
|
|
52
|
+
/** Monaco protocol taker fee in basis points - populated after fills */
|
|
53
|
+
monaco_taker_fee?: string;
|
|
54
|
+
/** Monaco protocol maker rebate in basis points - populated after fills */
|
|
55
|
+
monaco_maker_rebate?: string;
|
|
56
|
+
/** Total taker fees paid in quote currency - populated after fills */
|
|
57
|
+
total_taker_fees?: string;
|
|
58
|
+
/** Total payment for taker including fees in quote currency - populated after fills */
|
|
59
|
+
taker_total_payment?: string;
|
|
60
|
+
/** Total receipt for maker after rebates in quote currency - populated after fills */
|
|
61
|
+
maker_total_receipt?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Role of the creator or order
|
|
65
|
+
*/
|
|
66
|
+
export type OrderRole = "maker" | "taker";
|
|
67
|
+
/**
|
|
68
|
+
* Order side for trading operations
|
|
69
|
+
*/
|
|
70
|
+
export type OrderSide = "BUY" | "SELL";
|
|
71
|
+
/**
|
|
72
|
+
* Order type for different order strategies
|
|
73
|
+
* - LIMIT: Execute only at specified price or better
|
|
74
|
+
* - MARKET: Execute immediately at current market price
|
|
75
|
+
* - STOP_LOSS: Stop loss order triggered at trigger price
|
|
76
|
+
* - TAKE_PROFIT: Take profit order triggered at trigger price
|
|
77
|
+
* - STOP_LIMIT: Stop order that becomes a limit order when triggered
|
|
78
|
+
* - TRAILING_STOP: Stop order that trails the market price
|
|
79
|
+
*/
|
|
80
|
+
export type OrderType = "LIMIT" | "MARKET" | "STOP_LOSS" | "TAKE_PROFIT" | "STOP_LIMIT" | "TRAILING_STOP";
|
|
81
|
+
/**
|
|
82
|
+
* Order status for different order states
|
|
83
|
+
*
|
|
84
|
+
* Order lifecycle progression:
|
|
85
|
+
* - PENDING: Order created but not yet submitted to matching engine
|
|
86
|
+
* - SUBMITTED: Order submitted to matching engine for processing
|
|
87
|
+
* - ACKNOWLEDGED: Order acknowledged and validated by matching engine
|
|
88
|
+
* - PARTIALLY_FILLED: Order has been partially executed
|
|
89
|
+
* - FILLED: Order has been completely executed
|
|
90
|
+
* - SETTLED: Order has been settled on-chain
|
|
91
|
+
* - CANCELLED: Order was cancelled by user or system
|
|
92
|
+
* - REJECTED: Order was rejected due to validation failure
|
|
93
|
+
* - EXPIRED: Order expired based on time constraints
|
|
94
|
+
*/
|
|
95
|
+
export type OrderStatus = "PENDING" | "SUBMITTED" | "ACKNOWLEDGED" | "PARTIALLY_FILLED" | "FILLED" | "SETTLED" | "CANCELLED" | "REJECTED" | "EXPIRED";
|
|
96
|
+
/**
|
|
97
|
+
* Trading mode
|
|
98
|
+
*/
|
|
99
|
+
export type TradingMode = "SPOT" | "MARGIN";
|
|
100
|
+
/**
|
|
101
|
+
* Time in force for order execution
|
|
102
|
+
* - GTC: Good Till Cancel - remains active until filled or cancelled
|
|
103
|
+
* - IOC: Immediate or Cancel - execute immediately and cancel unfilled portion
|
|
104
|
+
* - FOK: Fill or Kill - execute completely or cancel entirely
|
|
105
|
+
* - GTD: Good Till Date - remains active until specified expiration date
|
|
106
|
+
*/
|
|
107
|
+
export type TimeInForce = "GTC" | "IOC" | "FOK" | "GTD";
|
|
108
|
+
//# sourceMappingURL=orders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../src/trading/orders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,KAAK;IACpB,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,yDAAyD;IACzD,UAAU,EAAE,SAAS,CAAC;IACtB,2DAA2D;IAC3D,MAAM,EAAE,WAAW,CAAC;IACpB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,eAAe,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,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