@0xmonaco/types 0.1.5 → 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.
@@ -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,7 @@
1
+ /**
2
+ * Applications Types
3
+ *
4
+ * Types for application configuration operations.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.js.map
@@ -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,7 @@
1
+ /**
2
+ * Applications Response Types
3
+ *
4
+ * Response types for application configuration operations.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/applications/responses.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -4,106 +4,87 @@
4
4
  * Types for authentication operations including challenge creation,
5
5
  * signature verification, and backend authentication.
6
6
  */
7
- import {
8
- type ChallengeResponse,
9
- type VerifyResponse,
10
- type BackendAuthResponse,
11
- type TokenRefreshResponse,
12
- User,
13
- } from "./responses";
7
+ import type { BackendAuthResponse, ChallengeResponse, TokenRefreshResponse, User, VerifyResponse } from "./responses";
14
8
  /**
15
9
  * Auth API interface.
16
10
  * Provides methods for frontend and backend authentication.
17
11
  * Handles challenge creation, signature verification, and backend auth.
18
12
  */
19
13
  export interface AuthAPI {
20
- /**
21
- * Complete authentication flow for frontend applications.
22
- *
23
- * This method handles the entire authentication process:
24
- * 1. Creates a challenge
25
- * 2. Signs the challenge message
26
- * 3. Verifies the signature and returns JWT tokens
27
- *
28
- * @param clientId - Client ID of the application
29
- * @returns Promise resolving to the verification response with JWT tokens
30
- */
31
- authenticate(clientId: string): Promise<VerifyResponse>;
32
- /**
33
- * Signs a challenge message using the wallet client.
34
- *
35
- * Signs the provided message using the wallet's private key.
36
- * This is used in the authentication flow to prove ownership of the wallet.
37
- *
38
- * @param message - The message to sign
39
- * @returns Promise resolving to the signature
40
- */
41
- signChallenge(message: string): Promise<string>;
42
- /**
43
- * Creates a challenge for frontend authentication.
44
- * Generates a unique nonce and message that the user must sign with their wallet.
45
- * @param address - Wallet address of the user
46
- * @param clientId - Client ID of the application
47
- * @returns Promise resolving to the challenge response
48
- */
49
- createChallenge(
50
- address: string,
51
- clientId: string,
52
- ): Promise<ChallengeResponse>;
53
- /**
54
- * Verifies a signature for frontend authentication.
55
- * Validates the signature against the challenge and returns JWT tokens.
56
- * @param address - Wallet address of the user
57
- * @param signature - Signature of the challenge message
58
- * @param nonce - Nonce from the challenge response
59
- * @param clientId - Client ID of the application
60
- * @returns Promise resolving to the verification response with JWT tokens
61
- */
62
- verifySignature(
63
- address: string,
64
- signature: string,
65
- nonce: string,
66
- clientId: string,
67
- ): Promise<VerifyResponse>;
68
- /**
69
- * Authenticates a backend service using a secret key.
70
- * Returns JWT tokens for API access.
71
- * @param secretKey - Secret key of the application
72
- * @returns Promise resolving to the backend auth response with JWT tokens
73
- */
74
- authenticateBackend(secretKey: string): Promise<BackendAuthResponse>;
75
- /**
76
- * Refreshes an access token using a refresh token.
77
- * @param refreshToken - The refresh token to use
78
- * @returns Promise resolving to new access and refresh tokens
79
- */
80
- refreshToken(refreshToken: string): Promise<TokenRefreshResponse>;
81
- /**
82
- * Revokes a refresh token.
83
- * @param refreshToken - The refresh token to revoke
84
- * @returns Promise resolving when the token is revoked
85
- */
86
- revokeToken(refreshToken: string): Promise<void>;
14
+ /**
15
+ * Complete authentication flow for frontend applications.
16
+ *
17
+ * This method handles the entire authentication process:
18
+ * 1. Creates a challenge
19
+ * 2. Signs the challenge message
20
+ * 3. Verifies the signature and returns JWT tokens
21
+ *
22
+ * @param clientId - Client ID of the application
23
+ * @returns Promise resolving to the verification response with JWT tokens
24
+ */
25
+ authenticate(clientId: string): Promise<VerifyResponse>;
26
+ /**
27
+ * Signs a challenge message using the wallet client.
28
+ *
29
+ * Signs the provided message using the wallet's private key.
30
+ * This is used in the authentication flow to prove ownership of the wallet.
31
+ *
32
+ * @param message - The message to sign
33
+ * @returns Promise resolving to the signature
34
+ */
35
+ signChallenge(message: string): Promise<string>;
36
+ /**
37
+ * Creates a challenge for frontend authentication.
38
+ * Generates a unique nonce and message that the user must sign with their wallet.
39
+ * @param address - Wallet address of the user
40
+ * @param clientId - Client ID of the application
41
+ * @returns Promise resolving to the challenge response
42
+ */
43
+ createChallenge(address: string, clientId: string): Promise<ChallengeResponse>;
44
+ /**
45
+ * Verifies a signature for frontend authentication.
46
+ * Validates the signature against the challenge and returns JWT tokens.
47
+ * @param address - Wallet address of the user
48
+ * @param signature - Signature of the challenge message
49
+ * @param nonce - Nonce from the challenge response
50
+ * @param clientId - Client ID of the application
51
+ * @returns Promise resolving to the verification response with JWT tokens
52
+ */
53
+ verifySignature(address: string, signature: string, nonce: string, clientId: string): Promise<VerifyResponse>;
54
+ /**
55
+ * Authenticates a backend service using a secret key.
56
+ * Returns JWT tokens for API access.
57
+ * @param secretKey - Secret key of the application
58
+ * @returns Promise resolving to the backend auth response with JWT tokens
59
+ */
60
+ authenticateBackend(secretKey: string): Promise<BackendAuthResponse>;
61
+ /**
62
+ * Refreshes an access token using a refresh token.
63
+ * @param refreshToken - The refresh token to use
64
+ * @returns Promise resolving to new access and refresh tokens
65
+ */
66
+ refreshToken(refreshToken: string): Promise<TokenRefreshResponse>;
67
+ /**
68
+ * Revokes a refresh token.
69
+ * @param refreshToken - The refresh token to revoke
70
+ * @returns Promise resolving when the token is revoked
71
+ */
72
+ revokeToken(refreshToken: string): Promise<void>;
87
73
  }
88
74
  /**
89
75
  * Authentication state containing all tokens and metadata
90
76
  */
91
77
  export interface AuthState {
92
- /** JWT access token for authenticated requests */
93
- accessToken: string;
94
- /** JWT refresh token for token renewal */
95
- refreshToken: string;
96
- /** Unix timestamp when the access token expires */
97
- expiresAt: number;
98
- /** Information about the authenticated user */
99
- user: User;
100
- /** When the auth state was created */
101
- createdAt: number;
78
+ /** JWT access token for authenticated requests */
79
+ accessToken: string;
80
+ /** JWT refresh token for token renewal */
81
+ refreshToken: string;
82
+ /** Unix timestamp when the access token expires */
83
+ expiresAt: number | string;
84
+ /** Information about the authenticated user */
85
+ user: User;
86
+ /** When the auth state was created */
87
+ createdAt: number;
102
88
  }
103
- export type {
104
- ChallengeResponse,
105
- VerifyResponse,
106
- BackendAuthResponse,
107
- TokenRefreshResponse,
108
- } from "./responses";
109
- //# sourceMappingURL=index.d.ts.map
89
+ export type { BackendAuthResponse, ChallengeResponse, TokenRefreshResponse, VerifyResponse, } from "./responses";
90
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,IAAI,EACJ,MAAM,aAAa,CAAC;AAMrB;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACvB;;;;;;;;;;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;;;;;;O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;;;;;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"}
@@ -7,60 +7,60 @@
7
7
  * Response to a challenge request.
8
8
  */
9
9
  export interface ChallengeResponse {
10
- /** Unique nonce for this challenge */
11
- nonce: string;
12
- /** Message to be signed by the user's wallet */
13
- message: string;
14
- /** Unix timestamp when the challenge expires */
15
- expiresAt: number;
10
+ /** Unique nonce for this challenge */
11
+ nonce: string;
12
+ /** Message to be signed by the user's wallet */
13
+ message: string;
14
+ /** Unix timestamp when the challenge expires */
15
+ expiresAt: number;
16
16
  }
17
17
  export interface User {
18
- /** Unique identifier for the user */
19
- id: string;
20
- /** Wallet address of the user */
21
- address: string;
22
- /** Username of the user */
23
- username?: string;
18
+ /** Unique identifier for the user */
19
+ id: string;
20
+ /** Wallet address of the user */
21
+ address: string;
22
+ /** Username of the user */
23
+ username?: string;
24
24
  }
25
25
  /**
26
26
  * Response to a signature verification request.
27
27
  */
28
28
  export interface VerifyResponse {
29
- /** JWT access token for authenticated requests */
30
- accessToken: string;
31
- /** JWT refresh token for token renewal */
32
- refreshToken: string;
33
- /** Unix timestamp when the access token expires */
34
- expiresAt: number;
35
- /** Information about the authenticated user */
36
- user: User;
29
+ /** JWT access token for authenticated requests */
30
+ accessToken: string;
31
+ /** JWT refresh token for token renewal */
32
+ refreshToken: string;
33
+ /** Unix timestamp when the access token expires */
34
+ expiresAt: number | string;
35
+ /** Information about the authenticated user */
36
+ user: User;
37
37
  }
38
38
  export interface ApplicationInfo {
39
- /** Unique identifier for the application */
40
- id: string;
41
- /** Human-readable name of the application */
42
- name: string;
43
- /** Client ID for frontend authentication */
44
- clientId: string;
39
+ /** Unique identifier for the application */
40
+ id: string;
41
+ /** Human-readable name of the application */
42
+ name: string;
43
+ /** Client ID for frontend authentication */
44
+ clientId: string;
45
45
  }
46
46
  /**
47
47
  * Response to a backend authentication request.
48
48
  */
49
49
  export interface BackendAuthResponse {
50
- /** JWT access token for authenticated requests */
51
- accessToken: string;
52
- /** Unix timestamp when the access token expires */
53
- expiresAt: number;
54
- /** Information about the application */
55
- application: ApplicationInfo;
50
+ /** JWT access token for authenticated requests */
51
+ accessToken: string;
52
+ /** Unix timestamp when the access token expires */
53
+ expiresAt: number;
54
+ /** Information about the application */
55
+ application: ApplicationInfo;
56
56
  }
57
57
  /**
58
58
  * Response to a token refresh request.
59
59
  */
60
60
  export interface TokenRefreshResponse {
61
- /** New JWT access token */
62
- accessToken: string;
63
- /** Unix timestamp when the access token expires */
64
- expiresAt: number;
61
+ /** New JWT access token */
62
+ accessToken: string;
63
+ /** Unix timestamp when the access token expires */
64
+ expiresAt: number;
65
65
  }
66
- //# sourceMappingURL=responses.d.ts.map
66
+ //# sourceMappingURL=responses.d.ts.map
@@ -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;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;IAC9B,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,IAAI,EAAE,IAAI,CAAC;CACX;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;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M,CAAC;CAClB"}
@@ -14,14 +14,14 @@ import { type Address } from "viem";
14
14
  * @property name - Full token name
15
15
  */
16
16
  export interface Token {
17
- /** Token contract address */
18
- address: Address;
19
- /** Token symbol (e.g. "ETH", "USDC") */
20
- symbol: string;
21
- /** Number of decimal places for token amounts */
22
- decimals: number;
23
- /** Full token name */
24
- name: string;
17
+ /** Token contract address */
18
+ address: Address;
19
+ /** Token symbol (e.g. "ETH", "USDC") */
20
+ symbol: string;
21
+ /** Number of decimal places for token amounts */
22
+ decimals: number;
23
+ /** Full token name */
24
+ name: string;
25
25
  }
26
26
  /**
27
27
  * Type representing a user's balance for a specific token in contract storage.
@@ -32,13 +32,13 @@ export interface Token {
32
32
  * @property total - Total balance (available + locked)
33
33
  */
34
34
  export interface UserBalance {
35
- /** Token address */
36
- token: string;
37
- /** Available balance for trading */
38
- available: bigint;
39
- /** Locked balance in open orders */
40
- locked: bigint;
41
- /** Total balance (available + locked) */
42
- total: bigint;
35
+ /** Token address */
36
+ token: string;
37
+ /** Available balance for trading */
38
+ available: bigint;
39
+ /** Locked balance in open orders */
40
+ locked: bigint;
41
+ /** Total balance (available + locked) */
42
+ total: bigint;
43
43
  }
44
- //# sourceMappingURL=balances.d.ts.map
44
+ //# sourceMappingURL=balances.d.ts.map
@@ -11,8 +11,8 @@ import { CONTRACT_ABIS } from "@0xmonaco/contracts";
11
11
  * @property VAULT - Vault contract address for managing user balances
12
12
  */
13
13
  export interface ContractAddresses {
14
- /** Vault contract address for managing user balances */
15
- VAULT: string;
14
+ /** Vault contract address for managing user balances */
15
+ VAULT: string;
16
16
  }
17
17
  /**
18
18
  * Type representing all contract instances.
@@ -21,8 +21,8 @@ export interface ContractAddresses {
21
21
  * @property vault - Vault contract instance for managing user balances
22
22
  */
23
23
  export type ContractInstances = {
24
- /** Vault contract instance for managing user balances */
25
- vault: GetContractReturnType<typeof CONTRACT_ABIS.vault>;
24
+ /** Vault contract instance for managing user balances */
25
+ vault: GetContractReturnType<typeof CONTRACT_ABIS.vault>;
26
26
  };
27
27
  export type { Token, UserBalance } from "./balances";
28
- //# sourceMappingURL=index.d.ts.map
28
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.d.ts CHANGED
@@ -5,10 +5,12 @@
5
5
  * It includes SDK types, vault types, trading types, contract types, and common types.
6
6
  */
7
7
  export * from "./api";
8
- export * from "./sdk";
9
- export * from "./vault";
10
- export * from "./trading";
11
- export * from "./contracts";
8
+ export * from "./applications";
12
9
  export * from "./auth";
10
+ export * from "./contracts";
13
11
  export * from "./profile";
12
+ export * from "./sdk";
13
+ export * from "./trading";
14
+ export * from "./vault";
15
+ export * from "./websocket";
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,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
@@ -6,10 +6,12 @@
6
6
  */
7
7
  // Export everything from all modules
8
8
  export * from "./api";
9
- export * from "./sdk";
10
- export * from "./vault";
11
- export * from "./trading";
12
- export * from "./contracts";
9
+ export * from "./applications";
13
10
  export * from "./auth";
11
+ export * from "./contracts";
14
12
  export * from "./profile";
13
+ export * from "./sdk";
14
+ export * from "./trading";
15
+ export * from "./vault";
16
+ export * from "./websocket";
15
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,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,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"}
@@ -1,13 +1,10 @@
1
- /**
2
- * SDK Types
3
- *
4
- * Core SDK configuration and main interface types.
5
- */
6
1
  import type { PublicClient, TransactionReceipt, Transport, WalletClient } from "viem";
2
+ import type { ApplicationsAPI } from "../applications";
7
3
  import type { AuthAPI, AuthState } from "../auth";
8
4
  import type { ProfileAPI } from "../profile";
9
5
  import type { TradingAPI } from "../trading";
10
6
  import type { VaultAPI } from "../vault";
7
+ import type { WebSocketClient } from "../websocket";
11
8
  import type { Network } from "./network";
12
9
  /**
13
10
  * Configuration options for the Monaco SDK.
@@ -27,6 +24,8 @@ export interface SDKConfig {
27
24
  * Core SDK interface providing access to all Monaco functionality.
28
25
  */
29
26
  export interface MonacoSDK {
27
+ /** Applications operations API */
28
+ applications: ApplicationsAPI;
30
29
  /** Auth operations API */
31
30
  auth: AuthAPI;
32
31
  /** Vault operations API */
@@ -35,12 +34,18 @@ export interface MonacoSDK {
35
34
  trading: TradingAPI;
36
35
  /** Profile operations API */
37
36
  profile: ProfileAPI;
37
+ /** WebSocket client for real-time events */
38
+ websocket: WebSocketClient;
38
39
  /** Wallet client for all blockchain operations */
39
40
  walletClient: WalletClient;
40
41
  /** Public client for read-only blockchain operations */
41
42
  publicClient: PublicClient;
42
43
  /** Complete authentication flow */
43
44
  login(clientId: string): Promise<AuthState>;
45
+ /** Logout the user */
46
+ logout(): Promise<void>;
47
+ /** Refresh the access token */
48
+ refreshAuth(): Promise<AuthState>;
44
49
  /** Get the current authentication state */
45
50
  getAuthState(): AuthState | undefined;
46
51
  /** Check if the user is authenticated */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,YAAY,EACZ,MAAM,MAAM,CAAC;AACd,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,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;AAMD;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,0BAA0B;IAC1B,IAAI,EAAE,OAAO,CAAC;IAEd,2BAA2B;IAC3B,KAAK,EAAE,QAAQ,CAAC;IAEhB,6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;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
@@ -1,7 +1,2 @@
1
- /**
2
- * SDK Types
3
- *
4
- * Core SDK configuration and main interface types.
5
- */
6
1
  export {};
7
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":""}
@@ -13,9 +13,10 @@ 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
- rpcUrl: string;
19
- apiUrl: string;
19
+ rpcUrl: string;
20
+ apiUrl: string;
20
21
  }
21
- //# sourceMappingURL=network.d.ts.map
22
+ //# sourceMappingURL=network.d.ts.map
@@ -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;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CACf"}
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"}
@@ -24,6 +24,8 @@ export interface TradingAPI extends BaseAPI {
24
24
  */
25
25
  placeLimitOrder(market: string, side: OrderSide, quantity: string, price: string, options?: {
26
26
  tradingMode?: string;
27
+ useMasterBalance?: boolean;
28
+ expirationDate?: string;
27
29
  }): Promise<CreateOrderResponse>;
28
30
  /**
29
31
  * Places a market order for immediate execution.
@@ -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,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;KACrB,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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,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"}
@@ -49,4 +49,8 @@ export type OrderStatus = "PENDING" | "SUBMITTED" | "FILLED" | "CANCELLED" | "RE
49
49
  * Trading mode
50
50
  */
51
51
  export type TradingMode = "SPOT" | "MARGIN" | "FUTURES";
52
+ /**
53
+ * Time in force
54
+ */
55
+ export type TimeInForce = "GTC";
52
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;;;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,M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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,14 +3,20 @@
3
3
  *
4
4
  * Types for vault operations including deposits, withdrawals, and balance management.
5
5
  */
6
- import { type BaseAPI } from "../api";
7
- import { type Balance, type TransactionResult } from "./responses";
6
+ import type { BaseAPI } from "../api";
7
+ import type { Balance, TransactionResult } from "./responses";
8
8
  /**
9
9
  * Vault API interface.
10
10
  * Provides methods for managing token deposits and withdrawals.
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;
14
20
  /**
15
21
  * Approves the vault to spend tokens.
16
22
  * @param token - Address of the token to approve
@@ -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,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMnE;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,OAAO;IACxC;;;;;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,QA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IG;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"}
@@ -7,26 +7,26 @@
7
7
  * Response from a transaction.
8
8
  */
9
9
  export interface TransactionResult {
10
- /** Transaction hash */
11
- hash: string;
12
- /** Transaction status */
13
- status: "pending" | "confirmed" | "failed";
14
- /** Nonce used for this operation */
15
- nonce: bigint;
10
+ /** Transaction hash */
11
+ hash: string;
12
+ /** Transaction status */
13
+ status: "pending" | "confirmed" | "failed";
14
+ /** Nonce used for this operation */
15
+ nonce: bigint;
16
16
  }
17
17
  /**
18
18
  * Token balance information.
19
19
  */
20
20
  export interface Balance {
21
- /** Token address */
22
- token: string;
23
- /** Balance amount */
24
- amount: bigint;
25
- /** Formatted balance string */
26
- formatted: string;
27
- /** Token symbol */
28
- symbol: string;
29
- /** Token decimals */
30
- decimals: number;
21
+ /** Token address */
22
+ token: string;
23
+ /** Balance amount */
24
+ amount: bigint;
25
+ /** Formatted balance string */
26
+ formatted: string;
27
+ /** Token symbol */
28
+ symbol: string;
29
+ /** Token decimals */
30
+ decimals: number;
31
31
  }
32
- //# sourceMappingURL=responses.d.ts.map
32
+ //# sourceMappingURL=responses.d.ts.map
@@ -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,7 @@
1
+ /**
2
+ * WebSocket Types
3
+ *
4
+ * Barebones types for WebSocket connections and real-time event handling.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/websocket/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",