@0xmonaco/types 0.1.1 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +3 -3
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/responses.d.ts +1 -1
- package/dist/auth/responses.d.ts.map +1 -1
- package/dist/contracts/balances.d.ts.map +1 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/profile/index.d.ts +93 -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 +25 -31
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +0 -5
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/network.d.ts +1 -0
- package/dist/sdk/network.d.ts.map +1 -1
- package/dist/trading/index.d.ts +38 -9
- package/dist/trading/index.d.ts.map +1 -1
- package/dist/trading/orders.d.ts +35 -1
- package/dist/trading/orders.d.ts.map +1 -1
- package/dist/trading/responses.d.ts +64 -8
- package/dist/trading/responses.d.ts.map +1 -1
- package/dist/vault/index.d.ts +9 -7
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/responses.d.ts.map +1 -1
- package/dist/websocket/index.d.ts +80 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/index.js +7 -0
- package/dist/websocket/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base API Types
|
|
3
|
+
*
|
|
4
|
+
* Common interface that all API implementations should inherit from.
|
|
5
|
+
* Provides standardized methods for token management and common functionality.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base API interface that all API implementations should inherit from.
|
|
9
|
+
* Provides common functionality for access token management.
|
|
10
|
+
*/
|
|
11
|
+
export interface BaseAPI {
|
|
12
|
+
/**
|
|
13
|
+
* Set the access token for authenticated requests.
|
|
14
|
+
*
|
|
15
|
+
* @param token - JWT access token
|
|
16
|
+
*/
|
|
17
|
+
setAccessToken(token: string): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,MAAM,WAAW,OAAO;IACvB;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applications Types
|
|
3
|
+
*
|
|
4
|
+
* Types for application configuration operations.
|
|
5
|
+
*/
|
|
6
|
+
import type { BaseAPI } from "../api";
|
|
7
|
+
import type { ApplicationConfigResponse } from "./responses";
|
|
8
|
+
/**
|
|
9
|
+
* Applications API interface.
|
|
10
|
+
* Provides methods for retrieving application configuration.
|
|
11
|
+
*/
|
|
12
|
+
export interface ApplicationsAPI extends BaseAPI {
|
|
13
|
+
/**
|
|
14
|
+
* Gets the configuration for the authenticated application.
|
|
15
|
+
*
|
|
16
|
+
* Returns the application's configuration including allowed origins,
|
|
17
|
+
* webhook URL, and other settings. Requires valid authentication.
|
|
18
|
+
*
|
|
19
|
+
* @returns Promise resolving to the application configuration
|
|
20
|
+
*/
|
|
21
|
+
getApplicationConfig(): Promise<ApplicationConfigResponse>;
|
|
22
|
+
}
|
|
23
|
+
export type { ApplicationConfigResponse } from "./responses";
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/applications/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAM7D;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC/C;;;;;;;OAOG;IACH,oBAAoB,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC3D;AAGD,YAAY,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/applications/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applications Response Types
|
|
3
|
+
*
|
|
4
|
+
* Response types for application configuration operations.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Response to an application configuration request.
|
|
8
|
+
*/
|
|
9
|
+
export interface ApplicationConfigResponse {
|
|
10
|
+
/** Unique identifier for the application */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Human-readable name of the application */
|
|
13
|
+
name: string;
|
|
14
|
+
/** List of allowed origins for CORS */
|
|
15
|
+
allowedOrigins: string[];
|
|
16
|
+
/** Webhook URL for receiving events (optional) */
|
|
17
|
+
webhookUrl?: string;
|
|
18
|
+
/** Vault contract address */
|
|
19
|
+
vaultContractAddress: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/applications/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,oBAAoB,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/applications/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Types for authentication operations including challenge creation,
|
|
5
5
|
* signature verification, and backend authentication.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import type { BackendAuthResponse, ChallengeResponse, TokenRefreshResponse, User, VerifyResponse } from "./responses";
|
|
8
8
|
/**
|
|
9
9
|
* Auth API interface.
|
|
10
10
|
* Provides methods for frontend and backend authentication.
|
|
@@ -80,11 +80,11 @@ export interface AuthState {
|
|
|
80
80
|
/** JWT refresh token for token renewal */
|
|
81
81
|
refreshToken: string;
|
|
82
82
|
/** Unix timestamp when the access token expires */
|
|
83
|
-
expiresAt: number;
|
|
83
|
+
expiresAt: number | string;
|
|
84
84
|
/** Information about the authenticated user */
|
|
85
85
|
user: User;
|
|
86
86
|
/** When the auth state was created */
|
|
87
87
|
createdAt: number;
|
|
88
88
|
}
|
|
89
|
-
export type {
|
|
89
|
+
export type { BackendAuthResponse, ChallengeResponse, TokenRefreshResponse, VerifyResponse, } from "./responses";
|
|
90
90
|
//# sourceMappingURL=index.d.ts.map
|
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,
|
|
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;IACtB;;;;;;;;;;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/auth/responses.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface VerifyResponse {
|
|
|
31
31
|
/** JWT refresh token for token renewal */
|
|
32
32
|
refreshToken: string;
|
|
33
33
|
/** Unix timestamp when the access token expires */
|
|
34
|
-
expiresAt: number;
|
|
34
|
+
expiresAt: number | string;
|
|
35
35
|
/** Information about the authenticated user */
|
|
36
36
|
user: User;
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/auth/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/auth/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,IAAI;IACpB,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,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;CACZ;AAED,MAAM,WAAW,eAAe;IAC/B,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,WAAW,EAAE,eAAe,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../../src/contracts/balances.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC;;;;;;;;GAQG;AACH,MAAM,WAAW,KAAK;
|
|
1
|
+
{"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../../src/contracts/balances.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC;;;;;;;;GAQG;AACH,MAAM,WAAW,KAAK;IACrB,6BAA6B;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;CACb;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC3B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;CACd;AAMD;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,yDAAyD;IACzD,KAAK,EAAE,qBAAqB,CAAC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;CACzD,CAAC;AAGF,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
* This package provides TypeScript types for the Monaco protocol.
|
|
5
5
|
* It includes SDK types, vault types, trading types, contract types, and common types.
|
|
6
6
|
*/
|
|
7
|
+
export * from "./api";
|
|
8
|
+
export * from "./applications";
|
|
9
|
+
export * from "./auth";
|
|
10
|
+
export * from "./contracts";
|
|
11
|
+
export * from "./profile";
|
|
7
12
|
export * from "./sdk";
|
|
8
|
-
export * from "./vault";
|
|
9
13
|
export * from "./trading";
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
14
|
+
export * from "./vault";
|
|
15
|
+
export * from "./websocket";
|
|
12
16
|
//# sourceMappingURL=index.d.ts.map
|
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,
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
* It includes SDK types, vault types, trading types, contract types, and common types.
|
|
6
6
|
*/
|
|
7
7
|
// Export everything from all modules
|
|
8
|
+
export * from "./api";
|
|
9
|
+
export * from "./applications";
|
|
10
|
+
export * from "./auth";
|
|
11
|
+
export * from "./contracts";
|
|
12
|
+
export * from "./profile";
|
|
8
13
|
export * from "./sdk";
|
|
9
|
-
export * from "./vault";
|
|
10
14
|
export * from "./trading";
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
15
|
+
export * from "./vault";
|
|
16
|
+
export * from "./websocket";
|
|
13
17
|
//# sourceMappingURL=index.js.map
|
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,
|
|
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"}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 { Balance } from "../vault/responses";
|
|
8
|
+
import { OrderSide, OrderStatus, OrderType } from "../trading/orders";
|
|
9
|
+
/**
|
|
10
|
+
* Account movement/transaction information.
|
|
11
|
+
* Represents transactions/movements returned in the profile's recent_movements array.
|
|
12
|
+
*/
|
|
13
|
+
export interface ProfileMovement {
|
|
14
|
+
/** Movement identifier */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Movement type */
|
|
17
|
+
type: "deposit" | "withdrawal" | "trade" | "transfer" | string;
|
|
18
|
+
/** Token address */
|
|
19
|
+
token: string;
|
|
20
|
+
/** Amount of the movement (as string to preserve precision) */
|
|
21
|
+
amount: string;
|
|
22
|
+
/** Movement timestamp (ISO string) */
|
|
23
|
+
timestamp: string;
|
|
24
|
+
/** Transaction hash if applicable */
|
|
25
|
+
hash?: string;
|
|
26
|
+
/** Movement status */
|
|
27
|
+
status: "pending" | "confirmed" | "failed" | string;
|
|
28
|
+
/** Optional description of the movement */
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Order information for recent orders.
|
|
33
|
+
* Represents orders returned in the profile's recent_orders array.
|
|
34
|
+
*/
|
|
35
|
+
export interface ProfileOrder {
|
|
36
|
+
/** Order identifier */
|
|
37
|
+
id: string;
|
|
38
|
+
/** Trading pair/market identifier (e.g., "ETH-USD") */
|
|
39
|
+
trading_pair: string;
|
|
40
|
+
/** Order side */
|
|
41
|
+
side: OrderSide;
|
|
42
|
+
/** Order type */
|
|
43
|
+
order_type: OrderType;
|
|
44
|
+
/** Order price (null for market orders) */
|
|
45
|
+
price: string | null;
|
|
46
|
+
/** Order quantity */
|
|
47
|
+
quantity: string;
|
|
48
|
+
/** Order status */
|
|
49
|
+
status: OrderStatus;
|
|
50
|
+
/** Order creation timestamp (ISO string) */
|
|
51
|
+
created_at: string;
|
|
52
|
+
/** Order last update timestamp (ISO string) */
|
|
53
|
+
updated_at?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* User profile information returned by the /api/v1/accounts/me endpoint.
|
|
57
|
+
*/
|
|
58
|
+
export interface UserProfile {
|
|
59
|
+
/** Unique identifier for the user */
|
|
60
|
+
id: string;
|
|
61
|
+
/** Wallet address of the user */
|
|
62
|
+
address: string;
|
|
63
|
+
/** Username of the user (can be null) */
|
|
64
|
+
username: string | null;
|
|
65
|
+
/** Account type (e.g., "master") */
|
|
66
|
+
account_type: string;
|
|
67
|
+
/** Whether the user can withdraw funds */
|
|
68
|
+
can_withdraw: boolean;
|
|
69
|
+
/** Account creation timestamp (ISO string) */
|
|
70
|
+
created_at: string;
|
|
71
|
+
/** User's current balances */
|
|
72
|
+
balances: Balance[];
|
|
73
|
+
/** Recent account movements/transactions */
|
|
74
|
+
recent_movements: ProfileMovement[];
|
|
75
|
+
/** Recent trading orders */
|
|
76
|
+
recent_orders: ProfileOrder[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Profile API interface.
|
|
80
|
+
* Provides methods for fetching and managing user profile information.
|
|
81
|
+
*/
|
|
82
|
+
export interface ProfileAPI extends BaseAPI {
|
|
83
|
+
/**
|
|
84
|
+
* Get the current user's profile information.
|
|
85
|
+
*
|
|
86
|
+
* Fetches the profile data for the authenticated user using the /api/v1/accounts/me endpoint.
|
|
87
|
+
* Requires a valid access token to be set.
|
|
88
|
+
*
|
|
89
|
+
* @returns Promise resolving to the user's profile information
|
|
90
|
+
*/
|
|
91
|
+
getProfile(): Promise<UserProfile>;
|
|
92
|
+
}
|
|
93
|
+
//# 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,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMtE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IAC/D,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpD,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,iBAAiB;IACjB,UAAU,EAAE,SAAS,CAAC;IACtB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,YAAY,EAAE,OAAO,CAAC;IACtB,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,4CAA4C;IAC5C,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,4BAA4B;IAC5B,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAMD;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,OAAO;IACzC;;;;;;;OAOG;IACH,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CAGpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/profile/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { type TradingAPI } from "../trading";
|
|
10
|
-
import { AuthState, type AuthAPI } from "../auth";
|
|
1
|
+
import type { PublicClient, TransactionReceipt, Transport, WalletClient } from "viem";
|
|
2
|
+
import type { ApplicationsAPI } from "../applications";
|
|
3
|
+
import type { AuthAPI, AuthState } from "../auth";
|
|
4
|
+
import type { ProfileAPI } from "../profile";
|
|
5
|
+
import type { TradingAPI } from "../trading";
|
|
6
|
+
import type { VaultAPI } from "../vault";
|
|
7
|
+
import type { WebSocketClient } from "../websocket";
|
|
8
|
+
import type { Network } from "./network";
|
|
11
9
|
/**
|
|
12
10
|
* Configuration options for the Monaco SDK.
|
|
13
11
|
*
|
|
14
|
-
* The SDK
|
|
15
|
-
*
|
|
16
|
-
* - `signer`: Viem PrivateKeyAccount for more control over account management
|
|
17
|
-
* - `account`: Custom Account implementation (overrides privateKey/signer)
|
|
18
|
-
*
|
|
19
|
-
* At least one authentication method must be provided.
|
|
20
|
-
*
|
|
21
|
-
* The SDK supports Sei Mainnet and Sei Testnet, defaulting to mainnet if no network is specified.
|
|
12
|
+
* The SDK requires a wallet client for signing operations.
|
|
13
|
+
* It also supports Sei Mainnet and Sei Testnet, defaulting to mainnet if no network is specified.
|
|
22
14
|
*/
|
|
23
15
|
export interface SDKConfig {
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
signer?: PrivateKeyAccount;
|
|
28
|
-
/** Custom Account implementation (overrides privateKey/signer) */
|
|
29
|
-
account?: Account;
|
|
30
|
-
/** Optional network override (defaults to 'mainnet') */
|
|
16
|
+
/** Wallet client for signing operations */
|
|
17
|
+
walletClient: WalletClient;
|
|
18
|
+
/** Optional: Network override (defaults to 'mainnet') */
|
|
31
19
|
network?: Network;
|
|
20
|
+
/** Optional: Transport for the public client */
|
|
21
|
+
transport?: Transport;
|
|
32
22
|
}
|
|
33
23
|
/**
|
|
34
24
|
* Core SDK interface providing access to all Monaco functionality.
|
|
35
25
|
*/
|
|
36
26
|
export interface MonacoSDK {
|
|
27
|
+
/** Applications operations API */
|
|
28
|
+
applications: ApplicationsAPI;
|
|
37
29
|
/** Auth operations API */
|
|
38
30
|
auth: AuthAPI;
|
|
39
31
|
/** Vault operations API */
|
|
40
32
|
vault: VaultAPI;
|
|
41
33
|
/** Trading operations API */
|
|
42
34
|
trading: TradingAPI;
|
|
35
|
+
/** Profile operations API */
|
|
36
|
+
profile: ProfileAPI;
|
|
37
|
+
/** WebSocket client for real-time events */
|
|
38
|
+
websocket: WebSocketClient;
|
|
43
39
|
/** Wallet client for all blockchain operations */
|
|
44
40
|
walletClient: WalletClient;
|
|
45
41
|
/** Public client for read-only blockchain operations */
|
|
46
42
|
publicClient: PublicClient;
|
|
47
43
|
/** Complete authentication flow */
|
|
48
44
|
login(clientId: string): Promise<AuthState>;
|
|
45
|
+
/** Logout the user */
|
|
46
|
+
logout(): Promise<void>;
|
|
47
|
+
/** Refresh the access token */
|
|
48
|
+
refreshAuth(): Promise<AuthState>;
|
|
49
49
|
/** Get the current authentication state */
|
|
50
50
|
getAuthState(): AuthState | undefined;
|
|
51
51
|
/** Check if the user is authenticated */
|
|
@@ -58,12 +58,6 @@ export interface MonacoSDK {
|
|
|
58
58
|
getNetwork(): Network;
|
|
59
59
|
/** Get the current chain ID */
|
|
60
60
|
getChainId(): number;
|
|
61
|
-
/** Switch to a different account */
|
|
62
|
-
switchAccount(newAccount: Account): void;
|
|
63
|
-
/** Switch to a different private key */
|
|
64
|
-
switchPrivateKey(privateKey: Hex): void;
|
|
65
|
-
/** Check if the current account can sign messages */
|
|
66
|
-
canSign(): boolean;
|
|
67
61
|
/** Wait for a transaction to be confirmed */
|
|
68
62
|
waitForTransaction(hash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
|
|
69
63
|
}
|
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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACtF,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,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACzB,2CAA2C;IAC3C,YAAY,EAAE,YAAY,CAAC;IAE3B,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,gDAAgD;IAChD,SAAS,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,kCAAkC;IAClC,YAAY,EAAE,eAAe,CAAC;IAE9B,0BAA0B;IAC1B,IAAI,EAAE,OAAO,CAAC;IAEd,2BAA2B;IAC3B,KAAK,EAAE,QAAQ,CAAC;IAEhB,6BAA6B;IAC7B,OAAO,EAAE,UAAU,CAAC;IAEpB,6BAA6B;IAC7B,OAAO,EAAE,UAAU,CAAC;IAEpB,4CAA4C;IAC5C,SAAS,EAAE,eAAe,CAAC;IAE3B,kDAAkD;IAClD,YAAY,EAAE,YAAY,CAAC;IAE3B,wDAAwD;IACxD,YAAY,EAAE,YAAY,CAAC;IAE3B,mCAAmC;IACnC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAE5C,sBAAsB;IACtB,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,CACjB,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC/B;AAGD,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/sdk/index.js
CHANGED
package/dist/sdk/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":""}
|
package/dist/sdk/network.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type Network = "mainnet" | "testnet";
|
|
|
13
13
|
* Network endpoint configuration for the Monaco SDK.
|
|
14
14
|
*
|
|
15
15
|
* Contains the RPC URL and API URL for each supported network.
|
|
16
|
+
* WebSocket connections use the API URL with /ws endpoint and the access token is passed as a query parameter.
|
|
16
17
|
*/
|
|
17
18
|
export interface NetworkEndpoints {
|
|
18
19
|
rpcUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/sdk/network.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/sdk/network.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CACf"}
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -3,19 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for trading operations including order placement and management.
|
|
5
5
|
*/
|
|
6
|
+
import { type BaseAPI } from "../api";
|
|
6
7
|
import { type OrderSide } from "./orders";
|
|
7
|
-
import { type CancelOrderResponse, type UpdateOrderResponse, type CreateOrderResponse } from "./responses";
|
|
8
|
+
import { type CancelOrderResponse, type UpdateOrderResponse, type CreateOrderResponse, type ReplaceOrderResponse, type GetPaginatedOrdersResponse, type GetPaginatedOrdersParams, type GetOrderResponse } from "./responses";
|
|
8
9
|
/**
|
|
9
10
|
* Trading API interface.
|
|
10
11
|
* Provides methods for placing and managing orders.
|
|
11
12
|
* Handles order placement, cancellation, and execution.
|
|
12
13
|
*/
|
|
13
|
-
export interface TradingAPI {
|
|
14
|
-
/**
|
|
15
|
-
* Set the access token for the TradingAPI
|
|
16
|
-
* @param token - The access token to set
|
|
17
|
-
*/
|
|
18
|
-
setAccessToken(token: string): void;
|
|
14
|
+
export interface TradingAPI extends BaseAPI {
|
|
19
15
|
/**
|
|
20
16
|
* Places a limit order on the order book.
|
|
21
17
|
* @param market - Market identifier (e.g., "ETH-USD")
|
|
@@ -28,6 +24,8 @@ export interface TradingAPI {
|
|
|
28
24
|
*/
|
|
29
25
|
placeLimitOrder(market: string, side: OrderSide, quantity: string, price: string, options?: {
|
|
30
26
|
tradingMode?: string;
|
|
27
|
+
useMasterBalance?: boolean;
|
|
28
|
+
expirationDate?: string;
|
|
31
29
|
}): Promise<CreateOrderResponse>;
|
|
32
30
|
/**
|
|
33
31
|
* Places a market order for immediate execution.
|
|
@@ -59,7 +57,38 @@ export interface TradingAPI {
|
|
|
59
57
|
price?: string;
|
|
60
58
|
quantity?: string;
|
|
61
59
|
}): Promise<UpdateOrderResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Replaces an existing order with new parameters.
|
|
62
|
+
* Updates the order with new price, quantity, and balance settings.
|
|
63
|
+
* @param orderId - ID of the order to replace
|
|
64
|
+
* @param newOrder - New order parameters
|
|
65
|
+
* @param newOrder.price - New order price as string (optional)
|
|
66
|
+
* @param newOrder.quantity - New order quantity as string
|
|
67
|
+
* @param newOrder.useMasterBalance - Whether to use master balance (optional, defaults to false)
|
|
68
|
+
* @returns Promise resolving to the replace result
|
|
69
|
+
*/
|
|
70
|
+
replaceOrder(orderId: string, newOrder: {
|
|
71
|
+
price?: string;
|
|
72
|
+
quantity: string;
|
|
73
|
+
useMasterBalance?: boolean;
|
|
74
|
+
}): Promise<ReplaceOrderResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Gets paginated orders based on query parameters.
|
|
77
|
+
* @param params - Query parameters for filtering orders
|
|
78
|
+
* @param params.status - Filter by order status (optional)
|
|
79
|
+
* @param params.trading_pair - Filter by trading pair (optional)
|
|
80
|
+
* @param params.page - Page number for pagination (optional)
|
|
81
|
+
* @param params.page_size - Number of orders per page (optional)
|
|
82
|
+
* @returns Promise resolving to the paginated orders result
|
|
83
|
+
*/
|
|
84
|
+
getPaginatedOrders(params?: GetPaginatedOrdersParams): Promise<GetPaginatedOrdersResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* Gets a single order by its ID.
|
|
87
|
+
* @param orderId - ID of the order to retrieve
|
|
88
|
+
* @returns Promise resolving to the order details
|
|
89
|
+
*/
|
|
90
|
+
getOrder(orderId: string): Promise<GetOrderResponse>;
|
|
62
91
|
}
|
|
63
|
-
export type { OrderSide, OrderType, } from "./orders";
|
|
64
|
-
export type { OrderResponse, CancelOrderResponse, UpdateOrderResponse, CreateOrderResponse } from "./responses";
|
|
92
|
+
export type { Order, OrderSide, OrderType, OrderStatus, TradingMode, } from "./orders";
|
|
93
|
+
export type { OrderResponse, CancelOrderResponse, UpdateOrderResponse, CreateOrderResponse, ReplaceOrderResponse, ClosePositionResponse, GetPaginatedOrdersResponse, GetPaginatedOrdersParams, GetOrderResponse, } from "./responses";
|
|
65
94
|
//# 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,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAMrB;;;;GAIG;AACH,MAAM,WAAW,
|
|
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,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAMrB;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,OAAO;IAC1C;;;;;;;;;OASG;IACH,eAAe,CACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QACT,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;KACxB,GACC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;;;;;OAQG;IACH,gBAAgB,CACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QACT,WAAW,CAAC,EAAE,MAAM,CAAC;KACrB,GACC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE1D;;;;;;;OAOG;IACH,WAAW,CACT,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GACA,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;;;;;;OASG;IACH,YAAY,CACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,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,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,GACX,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,aAAa,CAAC"}
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for trading operations and order management.
|
|
5
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
|
+
export interface Order {
|
|
11
|
+
/** Order identifier */
|
|
12
|
+
order_id: string;
|
|
13
|
+
/** Trading pair (e.g., "USDCo/MTK") */
|
|
14
|
+
trading_pair: string;
|
|
15
|
+
/** Order side */
|
|
16
|
+
side: OrderSide;
|
|
17
|
+
/** Order type */
|
|
18
|
+
order_type: OrderType;
|
|
19
|
+
/** Order status */
|
|
20
|
+
status: OrderStatus;
|
|
21
|
+
/** Order price */
|
|
22
|
+
price: string;
|
|
23
|
+
/** Order quantity */
|
|
24
|
+
quantity: string;
|
|
25
|
+
/** Filled quantity */
|
|
26
|
+
filled_quantity: string;
|
|
27
|
+
/** Remaining quantity */
|
|
28
|
+
remaining_quantity: string;
|
|
29
|
+
/** Trading mode */
|
|
30
|
+
trading_mode: TradingMode;
|
|
31
|
+
/** Order creation timestamp */
|
|
32
|
+
created_at: string;
|
|
33
|
+
/** Order update timestamp */
|
|
34
|
+
updated_at: string;
|
|
35
|
+
}
|
|
6
36
|
/**
|
|
7
37
|
* Order side for trading operations
|
|
8
38
|
*/
|
|
@@ -14,9 +44,13 @@ export type OrderType = "LIMIT" | "MARKET" | "POST_ONLY";
|
|
|
14
44
|
/**
|
|
15
45
|
* Order status for different order states
|
|
16
46
|
*/
|
|
17
|
-
export type OrderStatus = "SUBMITTED" | "FILLED" | "CANCELLED" | "REJECTED" | "PARTIALLY_FILLED";
|
|
47
|
+
export type OrderStatus = "PENDING" | "SUBMITTED" | "FILLED" | "CANCELLED" | "REJECTED" | "PARTIALLY_FILLED";
|
|
18
48
|
/**
|
|
19
49
|
* Trading mode
|
|
20
50
|
*/
|
|
21
51
|
export type TradingMode = "SPOT" | "MARGIN" | "FUTURES";
|
|
52
|
+
/**
|
|
53
|
+
* Time in force
|
|
54
|
+
*/
|
|
55
|
+
export type TimeInForce = "GTC";
|
|
22
56
|
//# sourceMappingURL=orders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../src/trading/orders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;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,
|
|
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,GAAG,SAAS,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC"}
|
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Response types for trading operations.
|
|
5
5
|
*/
|
|
6
|
+
import type { Order, OrderStatus } from "./orders";
|
|
7
|
+
/**
|
|
8
|
+
* Response from placing an order (legacy - kept for backward compatibility).
|
|
9
|
+
*/
|
|
10
|
+
export interface OrderResponse {
|
|
11
|
+
/** Order identifier */
|
|
12
|
+
orderId: string;
|
|
13
|
+
/** Order status */
|
|
14
|
+
status: "accepted" | "rejected";
|
|
15
|
+
/** Timestamp of the response */
|
|
16
|
+
timestamp: number;
|
|
17
|
+
}
|
|
6
18
|
/**
|
|
7
19
|
* Response from creating an order.
|
|
8
20
|
*/
|
|
@@ -45,15 +57,22 @@ export interface UpdateOrderResponse {
|
|
|
45
57
|
};
|
|
46
58
|
}
|
|
47
59
|
/**
|
|
48
|
-
* Response from
|
|
60
|
+
* Response from replacing an order.
|
|
49
61
|
*/
|
|
50
|
-
export interface
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
|
|
62
|
+
export interface ReplaceOrderResponse {
|
|
63
|
+
/** Original order identifier that was replaced */
|
|
64
|
+
original_order_id: string;
|
|
65
|
+
/** New order identifier */
|
|
66
|
+
new_order_id: string;
|
|
67
|
+
/** Replace operation status */
|
|
68
|
+
status: "SUCCESS" | "FAILED";
|
|
69
|
+
/** 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
|
+
};
|
|
57
76
|
}
|
|
58
77
|
/**
|
|
59
78
|
* Response from closing a position (legacy - kept for backward compatibility).
|
|
@@ -70,4 +89,41 @@ export interface ClosePositionResponse {
|
|
|
70
89
|
/** Timestamp of the response */
|
|
71
90
|
timestamp: number;
|
|
72
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Query parameters for getting paginated orders
|
|
94
|
+
*/
|
|
95
|
+
export interface GetPaginatedOrdersParams {
|
|
96
|
+
/** Filter by order status */
|
|
97
|
+
status?: OrderStatus;
|
|
98
|
+
/** Filter by trading pair */
|
|
99
|
+
trading_pair?: string;
|
|
100
|
+
/** Page number for pagination (default: 1) */
|
|
101
|
+
page?: number;
|
|
102
|
+
/** Number of orders per page (default: 10, max: 100) */
|
|
103
|
+
page_size?: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Response from getting paginated orders
|
|
107
|
+
*/
|
|
108
|
+
export interface GetPaginatedOrdersResponse {
|
|
109
|
+
/** Array of orders */
|
|
110
|
+
orders: Order[];
|
|
111
|
+
/** Total number of orders matching the query */
|
|
112
|
+
total: number;
|
|
113
|
+
/** Current page number */
|
|
114
|
+
page: number;
|
|
115
|
+
/** Number of orders per page */
|
|
116
|
+
page_size: number;
|
|
117
|
+
/** Total number of pages */
|
|
118
|
+
total_pages: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Response from getting a single order by ID
|
|
122
|
+
*/
|
|
123
|
+
export interface GetOrderResponse {
|
|
124
|
+
/** Order data */
|
|
125
|
+
order: Order;
|
|
126
|
+
/** Request status */
|
|
127
|
+
status: "SUCCESS" | "FAILED";
|
|
128
|
+
}
|
|
73
129
|
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/trading/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
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;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;IAChC,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,+BAA+B;IAC/B,YAAY,CAAC,EAAE;QACd,iDAAiD;QACjD,kBAAkB,EAAE,MAAM,CAAC;QAC3B,0BAA0B;QAC1B,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,qBAAqB;IACrB,cAAc,EAAE;QACf,+BAA+B;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kCAAkC;QAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,iDAAiD;IACjD,YAAY,CAAC,EAAE;QACb,iDAAiD;QACjD,kBAAkB,EAAE,MAAM,CAAC;QAC3B,0BAA0B;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,eAAe,CAAC;IACnD,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;CAClB;AAGD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,6BAA6B;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,sBAAsB;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;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,iBAAiB;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,qBAAqB;IACrB,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B"}
|
package/dist/vault/index.d.ts
CHANGED
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for vault operations including deposits, withdrawals, and balance management.
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import type { BaseAPI } from "../api";
|
|
7
|
+
import type { Balance, TransactionResult } from "./responses";
|
|
7
8
|
/**
|
|
8
9
|
* Vault API interface.
|
|
9
10
|
* Provides methods for managing token deposits and withdrawals.
|
|
10
11
|
* Handles token approvals and balance management.
|
|
11
12
|
*/
|
|
12
|
-
export interface VaultAPI {
|
|
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;
|
|
13
20
|
/**
|
|
14
21
|
* Approves the vault to spend tokens.
|
|
15
22
|
* @param token - Address of the token to approve
|
|
@@ -50,11 +57,6 @@ export interface VaultAPI {
|
|
|
50
57
|
* @returns Promise resolving to whether approval is needed
|
|
51
58
|
*/
|
|
52
59
|
needsApproval(token: string, amount: bigint): Promise<boolean>;
|
|
53
|
-
/**
|
|
54
|
-
* Set the access token for the VaultAPI
|
|
55
|
-
* @param token - The access token to set
|
|
56
|
-
*/
|
|
57
|
-
setAccessToken(token: string): void;
|
|
58
60
|
}
|
|
59
61
|
export type { Balance, TransactionResult } from "./responses";
|
|
60
62
|
//# 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,EAAE,KAAK,OAAO,EAAE,
|
|
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;;;;OAIG;IACH,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5C;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEnE;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEnE;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEpE;;;;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;CAC/D;AAGD,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -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;
|
|
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;CACd;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket Types
|
|
3
|
+
*
|
|
4
|
+
* Barebones types for WebSocket connections and real-time event handling.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base interface for all WebSocket events
|
|
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";
|
|
21
|
+
/**
|
|
22
|
+
* WebSocket connection configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface WebSocketConfig {
|
|
25
|
+
/** WebSocket URL */
|
|
26
|
+
wsUrl: string;
|
|
27
|
+
/** JWT access token for authentication (optional, can be set later) */
|
|
28
|
+
accessToken?: string;
|
|
29
|
+
/** Auto-reconnect on disconnect (default: true) */
|
|
30
|
+
autoReconnect?: boolean;
|
|
31
|
+
/** Reconnection delay in milliseconds (default: 5000) */
|
|
32
|
+
reconnectDelay?: number;
|
|
33
|
+
/** Maximum reconnection attempts (default: 5) */
|
|
34
|
+
maxReconnectAttempts?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Base error event that can be used across different components
|
|
38
|
+
*/
|
|
39
|
+
export interface BaseErrorEvent {
|
|
40
|
+
type: string;
|
|
41
|
+
message: string;
|
|
42
|
+
timestamp: number;
|
|
43
|
+
code?: string | number;
|
|
44
|
+
details?: any;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Basic WebSocket client interface
|
|
48
|
+
*/
|
|
49
|
+
export interface WebSocketClient {
|
|
50
|
+
/**
|
|
51
|
+
* Connect to the WebSocket server
|
|
52
|
+
* @returns Promise that resolves when connected
|
|
53
|
+
*/
|
|
54
|
+
connect(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Disconnect from the WebSocket server
|
|
57
|
+
*/
|
|
58
|
+
disconnect(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Get current connection status
|
|
61
|
+
* @returns Current connection status
|
|
62
|
+
*/
|
|
63
|
+
getConnectionStatus(): ConnectionStatus;
|
|
64
|
+
/**
|
|
65
|
+
* Check if currently connected
|
|
66
|
+
* @returns True if connected
|
|
67
|
+
*/
|
|
68
|
+
isConnected(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Set the access token for authentication
|
|
71
|
+
* @param token - JWT access token
|
|
72
|
+
*/
|
|
73
|
+
setAccessToken(token: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Send a message through the WebSocket connection
|
|
76
|
+
* @param data - Message data to send
|
|
77
|
+
*/
|
|
78
|
+
send(data: any): void;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,cAAc,GAAG,YAAY,GAAG,cAAc,CAAC;AAE5F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,UAAU,IAAI,IAAI,CAAC;IAEnB;;;OAGG;IACH,mBAAmB,IAAI,gBAAgB,CAAC;IAExC;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|