@0xmonaco/types 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/dist/api/index.d.ts +0 -18
- package/dist/api/index.js +0 -6
- package/dist/applications/index.d.ts +0 -23
- package/dist/applications/index.js +0 -5
- package/dist/applications/responses.d.ts +0 -22
- package/dist/applications/responses.js +0 -5
- package/dist/auth/index.d.ts +0 -81
- package/dist/auth/index.js +0 -6
- package/dist/auth/responses.d.ts +0 -67
- package/dist/auth/responses.js +0 -5
- package/dist/contracts/balances.d.ts +0 -43
- package/dist/contracts/balances.js +0 -5
- package/dist/contracts/index.d.ts +0 -27
- package/dist/contracts/index.js +0 -5
- package/dist/fees/index.d.ts +0 -39
- package/dist/fees/index.js +0 -6
- package/dist/fees/responses.d.ts +0 -54
- package/dist/fees/responses.js +0 -86
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -21
- package/dist/margin-accounts/index.d.ts +0 -110
- package/dist/margin-accounts/index.js +0 -0
- package/dist/market/index.d.ts +0 -312
- package/dist/market/index.js +0 -5
- package/dist/positions/index.d.ts +0 -128
- package/dist/positions/index.js +0 -0
- package/dist/profile/index.d.ts +0 -405
- package/dist/profile/index.js +0 -5
- package/dist/sdk/index.d.ts +0 -131
- package/dist/sdk/index.js +0 -0
- package/dist/sdk/network.d.ts +0 -25
- package/dist/sdk/network.js +0 -5
- package/dist/trading/index.d.ts +0 -132
- package/dist/trading/index.js +0 -6
- package/dist/trading/orders.d.ts +0 -137
- package/dist/trading/orders.js +0 -9
- package/dist/trading/responses.d.ts +0 -347
- package/dist/trading/responses.js +0 -5
- package/dist/validation/common.d.ts +0 -179
- package/dist/validation/common.js +0 -199
- package/dist/validation/index.d.ts +0 -22
- package/dist/validation/index.js +0 -24
- package/dist/validation/margin-accounts.d.ts +0 -55
- package/dist/validation/margin-accounts.js +0 -59
- package/dist/validation/market.d.ts +0 -214
- package/dist/validation/market.js +0 -225
- package/dist/validation/positions.d.ts +0 -89
- package/dist/validation/positions.js +0 -93
- package/dist/validation/profile.d.ts +0 -69
- package/dist/validation/profile.js +0 -44
- package/dist/validation/trading.d.ts +0 -350
- package/dist/validation/trading.js +0 -313
- package/dist/validation/vault.d.ts +0 -66
- package/dist/validation/vault.js +0 -79
- package/dist/vault/index.d.ts +0 -84
- package/dist/vault/index.js +0 -5
- package/dist/vault/responses.d.ts +0 -51
- package/dist/vault/responses.js +0 -5
- package/dist/websocket/base.d.ts +0 -31
- package/dist/websocket/base.js +0 -5
- package/dist/websocket/clients/orderbook-client.d.ts +0 -14
- package/dist/websocket/clients/orderbook-client.js +0 -3
- package/dist/websocket/events/balance-events.d.ts +0 -48
- package/dist/websocket/events/balance-events.js +0 -6
- package/dist/websocket/events/conditional-order-events.d.ts +0 -33
- package/dist/websocket/events/conditional-order-events.js +0 -0
- package/dist/websocket/events/index.d.ts +0 -7
- package/dist/websocket/events/index.js +0 -7
- package/dist/websocket/events/movement-events.d.ts +0 -64
- package/dist/websocket/events/movement-events.js +0 -6
- package/dist/websocket/events/ohlcv-events.d.ts +0 -31
- package/dist/websocket/events/ohlcv-events.js +0 -5
- package/dist/websocket/events/orderbook-events.d.ts +0 -72
- package/dist/websocket/events/orderbook-events.js +0 -5
- package/dist/websocket/events/orders-events.d.ts +0 -284
- package/dist/websocket/events/orders-events.js +0 -0
- package/dist/websocket/events/trade-events.d.ts +0 -34
- package/dist/websocket/events/trade-events.js +0 -5
- package/dist/websocket/index.d.ts +0 -8
- package/dist/websocket/index.js +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint": "biome lint ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@0xmonaco/contracts": "
|
|
23
|
+
"@0xmonaco/contracts": "0.7.7",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
package/dist/api/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/api/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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";
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
/** Application client ID, embedded in on-chain deposit calls */
|
|
21
|
-
clientId: string;
|
|
22
|
-
}
|
package/dist/auth/index.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth Types
|
|
3
|
-
*
|
|
4
|
-
* Types for authentication operations including challenge creation,
|
|
5
|
-
* signature verification, and backend authentication.
|
|
6
|
-
*/
|
|
7
|
-
import type { BaseAPI } from "../api";
|
|
8
|
-
import type { AuthState, BackendAuthResponse, ChallengeResponse, TokenRefreshResponse } from "./responses";
|
|
9
|
-
/**
|
|
10
|
-
* Auth API interface.
|
|
11
|
-
* Provides methods for frontend and backend authentication.
|
|
12
|
-
* Handles challenge creation, signature verification, and backend auth.
|
|
13
|
-
*/
|
|
14
|
-
export interface AuthAPI extends BaseAPI {
|
|
15
|
-
/**
|
|
16
|
-
* Complete authentication flow for frontend applications.
|
|
17
|
-
*
|
|
18
|
-
* This method handles the entire authentication process:
|
|
19
|
-
* 1. Creates a challenge
|
|
20
|
-
* 2. Signs the challenge message
|
|
21
|
-
* 3. Verifies the signature and returns JWT tokens
|
|
22
|
-
*
|
|
23
|
-
* @param clientId - Client ID of the application
|
|
24
|
-
* @returns Promise resolving to the authentication state with JWT tokens
|
|
25
|
-
*/
|
|
26
|
-
authenticate(clientId: string): Promise<AuthState>;
|
|
27
|
-
/**
|
|
28
|
-
* Signs a challenge message using the wallet client.
|
|
29
|
-
*
|
|
30
|
-
* Signs the provided message using the wallet's private key.
|
|
31
|
-
* This is used in the authentication flow to prove ownership of the wallet.
|
|
32
|
-
*
|
|
33
|
-
* @param message - The message to sign
|
|
34
|
-
* @returns Promise resolving to the signature
|
|
35
|
-
*/
|
|
36
|
-
signChallenge(message: string): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a challenge for frontend authentication.
|
|
39
|
-
* Generates a unique nonce and message that the user must sign with their wallet.
|
|
40
|
-
* @param address - Wallet address of the user
|
|
41
|
-
* @param clientId - Client ID of the application
|
|
42
|
-
* @returns Promise resolving to the challenge response
|
|
43
|
-
*/
|
|
44
|
-
createChallenge(address: string, clientId: string): Promise<ChallengeResponse>;
|
|
45
|
-
/**
|
|
46
|
-
* Verifies a signature for frontend authentication.
|
|
47
|
-
* Validates the signature against the challenge and returns JWT tokens.
|
|
48
|
-
* @param address - Wallet address of the user
|
|
49
|
-
* @param signature - Signature of the challenge message
|
|
50
|
-
* @param nonce - Nonce from the challenge response
|
|
51
|
-
* @param clientId - Client ID of the application
|
|
52
|
-
* @returns Promise resolving to the authentication state with JWT tokens
|
|
53
|
-
*/
|
|
54
|
-
verifySignature(address: string, signature: string, nonce: string, clientId: string): Promise<AuthState>;
|
|
55
|
-
/**
|
|
56
|
-
* Authenticates a backend service using a secret key.
|
|
57
|
-
* Returns JWT tokens for API access.
|
|
58
|
-
* @param secretKey - Secret key of the application
|
|
59
|
-
* @returns Promise resolving to the backend auth response with JWT tokens
|
|
60
|
-
*/
|
|
61
|
-
authenticateBackend(secretKey: string): Promise<BackendAuthResponse>;
|
|
62
|
-
/**
|
|
63
|
-
* Refreshes an access token using a refresh token.
|
|
64
|
-
* @param refreshToken - The refresh token to use
|
|
65
|
-
* @returns Promise resolving to new access and refresh tokens
|
|
66
|
-
*/
|
|
67
|
-
refreshToken(refreshToken: string): Promise<TokenRefreshResponse>;
|
|
68
|
-
/**
|
|
69
|
-
* Revokes the current session's refresh token.
|
|
70
|
-
* The server identifies the token to revoke from the access token in the Authorization header.
|
|
71
|
-
* @returns Promise resolving when the token is revoked
|
|
72
|
-
*/
|
|
73
|
-
revokeToken(): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Sets the wallet client for signing operations.
|
|
76
|
-
* Used when the wallet becomes available after SDK initialization.
|
|
77
|
-
* @param walletClient - The wallet client to set
|
|
78
|
-
*/
|
|
79
|
-
setWalletClient(walletClient: unknown): void;
|
|
80
|
-
}
|
|
81
|
-
export type { ApplicationInfo, AuthState, BackendAuthResponse, ChallengeResponse, TokenRefreshResponse, User, } from "./responses";
|
package/dist/auth/index.js
DELETED
package/dist/auth/responses.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth Response Types
|
|
3
|
-
*
|
|
4
|
-
* Response types for authentication operations.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Response to a challenge request.
|
|
8
|
-
*/
|
|
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;
|
|
16
|
-
}
|
|
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;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Authentication state containing all tokens and metadata
|
|
27
|
-
*
|
|
28
|
-
* Returned by authentication methods and contains the tokens needed for API access.
|
|
29
|
-
*/
|
|
30
|
-
export interface AuthState {
|
|
31
|
-
/** JWT access token for authenticated requests */
|
|
32
|
-
accessToken: string;
|
|
33
|
-
/** JWT refresh token for token renewal and revocation */
|
|
34
|
-
refreshToken: string;
|
|
35
|
-
/** Unix timestamp (in seconds) when the access token expires */
|
|
36
|
-
expiresAt: number;
|
|
37
|
-
/** Information about the authenticated user */
|
|
38
|
-
user: User;
|
|
39
|
-
}
|
|
40
|
-
export interface ApplicationInfo {
|
|
41
|
-
/** Unique identifier for the application */
|
|
42
|
-
id: string;
|
|
43
|
-
/** Human-readable name of the application */
|
|
44
|
-
name: string;
|
|
45
|
-
/** Client ID for frontend authentication */
|
|
46
|
-
clientId: string;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Response to a backend authentication request.
|
|
50
|
-
*/
|
|
51
|
-
export interface BackendAuthResponse {
|
|
52
|
-
/** JWT access token for authenticated requests */
|
|
53
|
-
accessToken: string;
|
|
54
|
-
/** Unix timestamp when the access token expires */
|
|
55
|
-
expiresAt: number;
|
|
56
|
-
/** Information about the application */
|
|
57
|
-
application: ApplicationInfo;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Response to a token refresh request.
|
|
61
|
-
*/
|
|
62
|
-
export interface TokenRefreshResponse {
|
|
63
|
-
/** New JWT access token */
|
|
64
|
-
accessToken: string;
|
|
65
|
-
/** Unix timestamp when the access token expires */
|
|
66
|
-
expiresAt: number;
|
|
67
|
-
}
|
package/dist/auth/responses.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contract Balance Types
|
|
3
|
-
*
|
|
4
|
-
* Types for contract balance management and token information.
|
|
5
|
-
*/
|
|
6
|
-
import type { Address } from "viem";
|
|
7
|
-
/**
|
|
8
|
-
* Type representing a token in the Monaco Markets protocol.
|
|
9
|
-
* Contains essential token metadata and contract information.
|
|
10
|
-
*
|
|
11
|
-
* @property address - Token contract address
|
|
12
|
-
* @property symbol - Token symbol (e.g. "ETH", "USDC")
|
|
13
|
-
* @property decimals - Number of decimal places for token amounts
|
|
14
|
-
* @property name - Full token name
|
|
15
|
-
*/
|
|
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;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Type representing a user's balance for a specific token in contract storage.
|
|
28
|
-
*
|
|
29
|
-
* @property token - Token address
|
|
30
|
-
* @property available - Available balance for trading
|
|
31
|
-
* @property locked - Locked balance in open orders
|
|
32
|
-
* @property total - Total balance (available + locked)
|
|
33
|
-
*/
|
|
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;
|
|
43
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contract Types
|
|
3
|
-
*
|
|
4
|
-
* Types for contract addresses, instances, and contract-related operations.
|
|
5
|
-
*/
|
|
6
|
-
import type { CONTRACT_ABIS } from "@0xmonaco/contracts";
|
|
7
|
-
import type { GetContractReturnType } from "viem";
|
|
8
|
-
/**
|
|
9
|
-
* Interface for all contract addresses in the Monaco Markets protocol.
|
|
10
|
-
*
|
|
11
|
-
* @property VAULT - Vault contract address for managing user balances
|
|
12
|
-
*/
|
|
13
|
-
export interface ContractAddresses {
|
|
14
|
-
/** Vault contract address for managing user balances */
|
|
15
|
-
VAULT: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Type representing all contract instances.
|
|
19
|
-
* Maps contract names to their typed instances with full ABI type safety.
|
|
20
|
-
*
|
|
21
|
-
* @property vault - Vault contract instance for managing user balances
|
|
22
|
-
*/
|
|
23
|
-
export type ContractInstances = {
|
|
24
|
-
/** Vault contract instance for managing user balances */
|
|
25
|
-
vault: GetContractReturnType<typeof CONTRACT_ABIS.vault>;
|
|
26
|
-
};
|
|
27
|
-
export type { Token, UserBalance } from "./balances";
|
package/dist/contracts/index.js
DELETED
package/dist/fees/index.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fees Types
|
|
3
|
-
*
|
|
4
|
-
* Types for fees operations including fee simulation.
|
|
5
|
-
*/
|
|
6
|
-
import type { BaseAPI } from "../api/index";
|
|
7
|
-
import type { SimulateFeeParams, SimulateFeeResponse } from "./responses";
|
|
8
|
-
/**
|
|
9
|
-
* Fees API interface.
|
|
10
|
-
* Provides methods for simulating and calculating trading fees.
|
|
11
|
-
*/
|
|
12
|
-
export interface FeesAPI extends BaseAPI {
|
|
13
|
-
/**
|
|
14
|
-
* Simulate fees for an order before placing it.
|
|
15
|
-
* Returns exact fees for that specific order.
|
|
16
|
-
*
|
|
17
|
-
* @param params - Parameters for fee simulation
|
|
18
|
-
* @param params.trading_pair_id - Trading pair ID
|
|
19
|
-
* @param params.side - Order side ("BUY" or "SELL")
|
|
20
|
-
* @param params.price - Price per unit
|
|
21
|
-
* @param params.quantity - Quantity to trade
|
|
22
|
-
* @returns Promise resolving to fee simulation details
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const feeDetails = await feesAPI.simulateFees({
|
|
27
|
-
* trading_pair_id: "123e4567-e89b-12d3-a456-426614174000",
|
|
28
|
-
* side: "BUY",
|
|
29
|
-
* price: "40000.00",
|
|
30
|
-
* quantity: "0.5"
|
|
31
|
-
* });
|
|
32
|
-
* console.log(`Total taker fees: ${feeDetails.total_taker_fees}`);
|
|
33
|
-
* console.log(`Taker must pay: ${feeDetails.taker_total_payment}`);
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
simulateFees(params: SimulateFeeParams): Promise<SimulateFeeResponse>;
|
|
37
|
-
}
|
|
38
|
-
export type { SimulateFeeParams, SimulateFeeResponse } from "./responses";
|
|
39
|
-
export { SimulateFeeParamsSchema, SimulateFeeResponseSchema } from "./responses";
|
package/dist/fees/index.js
DELETED
package/dist/fees/responses.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fees Response Types
|
|
3
|
-
*
|
|
4
|
-
* Types for fees-related API responses.
|
|
5
|
-
* All types are derived from Zod schemas for runtime validation.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
/**
|
|
9
|
-
* Zod schema for simulating order fees parameters
|
|
10
|
-
*/
|
|
11
|
-
export declare const SimulateFeeParamsSchema: z.ZodObject<{
|
|
12
|
-
trading_pair_id: z.ZodString;
|
|
13
|
-
side: z.ZodEnum<{
|
|
14
|
-
BUY: "BUY";
|
|
15
|
-
SELL: "SELL";
|
|
16
|
-
}>;
|
|
17
|
-
price: z.ZodString;
|
|
18
|
-
quantity: z.ZodString;
|
|
19
|
-
order_type: z.ZodOptional<z.ZodEnum<{
|
|
20
|
-
LIMIT: "LIMIT";
|
|
21
|
-
MARKET: "MARKET";
|
|
22
|
-
}>>;
|
|
23
|
-
slippage_tolerance_bps: z.ZodOptional<z.ZodNumber>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
/**
|
|
26
|
-
* Zod schema for fee simulation response
|
|
27
|
-
*/
|
|
28
|
-
export declare const SimulateFeeResponseSchema: z.ZodObject<{
|
|
29
|
-
application_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
-
application_taker_fee: z.ZodString;
|
|
31
|
-
application_taker_fee_bps: z.ZodNumber;
|
|
32
|
-
buy_order_lock_amount: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
-
maker_total_receipt: z.ZodString;
|
|
34
|
-
monaco_maker_rebate: z.ZodString;
|
|
35
|
-
monaco_maker_rebate_bps: z.ZodNumber;
|
|
36
|
-
monaco_taker_fee: z.ZodString;
|
|
37
|
-
monaco_taker_fee_bps: z.ZodNumber;
|
|
38
|
-
notional: z.ZodString;
|
|
39
|
-
taker_total_payment: z.ZodString;
|
|
40
|
-
total_taker_fees: z.ZodString;
|
|
41
|
-
max_quantity: z.ZodNullable<z.ZodString>;
|
|
42
|
-
max_quantity_raw: z.ZodNullable<z.ZodString>;
|
|
43
|
-
slippage_tolerance_bps: z.ZodNullable<z.ZodNumber>;
|
|
44
|
-
}, z.core.$strip>;
|
|
45
|
-
/**
|
|
46
|
-
* Parameters for simulating order fees
|
|
47
|
-
* @remarks Type is inferred from SimulateFeeParamsSchema
|
|
48
|
-
*/
|
|
49
|
-
export type SimulateFeeParams = z.infer<typeof SimulateFeeParamsSchema>;
|
|
50
|
-
/**
|
|
51
|
-
* Response with detailed fee breakdown for simulating order fees
|
|
52
|
-
* @remarks Type is inferred from SimulateFeeResponseSchema
|
|
53
|
-
*/
|
|
54
|
-
export type SimulateFeeResponse = z.infer<typeof SimulateFeeResponseSchema>;
|
package/dist/fees/responses.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fees Response Types
|
|
3
|
-
*
|
|
4
|
-
* Types for fees-related API responses.
|
|
5
|
-
* All types are derived from Zod schemas for runtime validation.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
/**
|
|
9
|
-
* Zod schema for simulating order fees parameters
|
|
10
|
-
*/
|
|
11
|
-
export const SimulateFeeParamsSchema = z
|
|
12
|
-
.object({
|
|
13
|
-
/** Trading pair ID */
|
|
14
|
-
trading_pair_id: z.string().trim().min(1, "Trading pair ID is required and cannot be empty"),
|
|
15
|
-
/** Order side: "BUY" or "SELL" */
|
|
16
|
-
side: z.enum(["BUY", "SELL"], {
|
|
17
|
-
message: "Order side is required and must be either 'BUY' or 'SELL'",
|
|
18
|
-
}),
|
|
19
|
-
/** Price per unit */
|
|
20
|
-
price: z
|
|
21
|
-
.string()
|
|
22
|
-
.trim()
|
|
23
|
-
.min(1, "Price is required and cannot be empty")
|
|
24
|
-
.refine((val) => !Number.isNaN(Number(val)), "Price must be a valid number")
|
|
25
|
-
.refine((val) => Number(val) > 0, "Price must be greater than 0"),
|
|
26
|
-
/** Quantity to trade */
|
|
27
|
-
quantity: z
|
|
28
|
-
.string()
|
|
29
|
-
.trim()
|
|
30
|
-
.min(1, "Quantity is required and cannot be empty")
|
|
31
|
-
.refine((val) => !Number.isNaN(Number(val)), "Quantity must be a valid number")
|
|
32
|
-
.refine((val) => Number(val) > 0, "Quantity must be greater than 0"),
|
|
33
|
-
/** Order type: "LIMIT" (default) or "MARKET". MARKET orders include a slippage buffer in the lock amount. */
|
|
34
|
-
order_type: z.enum(["LIMIT", "MARKET"]).optional(),
|
|
35
|
-
/** Slippage tolerance in basis points (0–1000). Only valid for MARKET orders. Default: 500 (5%). */
|
|
36
|
-
slippage_tolerance_bps: z
|
|
37
|
-
.number()
|
|
38
|
-
.int()
|
|
39
|
-
.min(0, "Slippage tolerance must be between 0 and 1000 bps")
|
|
40
|
-
.max(1000, "Slippage tolerance must be between 0 and 1000 bps")
|
|
41
|
-
.optional(),
|
|
42
|
-
})
|
|
43
|
-
.superRefine((data, ctx) => {
|
|
44
|
-
if (data.slippage_tolerance_bps !== undefined && data.order_type !== "MARKET") {
|
|
45
|
-
ctx.addIssue({
|
|
46
|
-
code: z.ZodIssueCode.custom,
|
|
47
|
-
message: "slippage_tolerance_bps is only valid when order_type is MARKET",
|
|
48
|
-
path: ["slippage_tolerance_bps"],
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Zod schema for fee simulation response
|
|
54
|
-
*/
|
|
55
|
-
export const SimulateFeeResponseSchema = z.object({
|
|
56
|
-
/** Application name (if applicable) */
|
|
57
|
-
application_name: z.string().nullable().optional(),
|
|
58
|
-
/** Frontend application taker fee */
|
|
59
|
-
application_taker_fee: z.string(),
|
|
60
|
-
/** Application fee in basis points */
|
|
61
|
-
application_taker_fee_bps: z.number(),
|
|
62
|
-
/** Amount to lock for BUY orders (null for `SELL`) */
|
|
63
|
-
buy_order_lock_amount: z.string().nullable().optional(),
|
|
64
|
-
/** Total amount maker receives */
|
|
65
|
-
maker_total_receipt: z.string(),
|
|
66
|
-
/** Monaco protocol maker rebate (negative = rebate) */
|
|
67
|
-
monaco_maker_rebate: z.string(),
|
|
68
|
-
/** Monaco maker rebate in basis points */
|
|
69
|
-
monaco_maker_rebate_bps: z.number(),
|
|
70
|
-
/** Monaco protocol taker fee */
|
|
71
|
-
monaco_taker_fee: z.string(),
|
|
72
|
-
/** Monaco taker fee in basis points */
|
|
73
|
-
monaco_taker_fee_bps: z.number(),
|
|
74
|
-
/** Notional value (price * quantity) */
|
|
75
|
-
notional: z.string(),
|
|
76
|
-
/** Total amount taker must pay */
|
|
77
|
-
taker_total_payment: z.string(),
|
|
78
|
-
/** Total taker fees (monaco + application) */
|
|
79
|
-
total_taker_fees: z.string(),
|
|
80
|
-
/** Maximum quantity affordable at the given price, accounting for fees (null if not authenticated or balance unavailable) */
|
|
81
|
-
max_quantity: z.string().nullable(),
|
|
82
|
-
/** Maximum quantity in RAW (smallest unit) format */
|
|
83
|
-
max_quantity_raw: z.string().nullable(),
|
|
84
|
-
/** Slippage tolerance used in the calculation, echoed back for MARKET orders (null for LIMIT orders) */
|
|
85
|
-
slippage_tolerance_bps: z.number().nullable(),
|
|
86
|
-
});
|
package/dist/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Monaco Types Package
|
|
3
|
-
*
|
|
4
|
-
* This package provides TypeScript types for the Monaco protocol.
|
|
5
|
-
* It includes SDK types, vault types, trading types, contract types, and common types.
|
|
6
|
-
*/
|
|
7
|
-
export * from "./api";
|
|
8
|
-
export * from "./applications";
|
|
9
|
-
export * from "./auth";
|
|
10
|
-
export * from "./contracts";
|
|
11
|
-
export * from "./fees";
|
|
12
|
-
export * from "./margin-accounts";
|
|
13
|
-
export * from "./market";
|
|
14
|
-
export * from "./positions";
|
|
15
|
-
export * from "./profile";
|
|
16
|
-
export * from "./sdk";
|
|
17
|
-
export * from "./trading";
|
|
18
|
-
export * from "./validation";
|
|
19
|
-
export * from "./vault";
|
|
20
|
-
export * from "./websocket";
|
package/dist/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Monaco Types Package
|
|
3
|
-
*
|
|
4
|
-
* This package provides TypeScript types for the Monaco protocol.
|
|
5
|
-
* It includes SDK types, vault types, trading types, contract types, and common types.
|
|
6
|
-
*/
|
|
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 "./fees";
|
|
13
|
-
export * from "./margin-accounts";
|
|
14
|
-
export * from "./market";
|
|
15
|
-
export * from "./positions";
|
|
16
|
-
export * from "./profile";
|
|
17
|
-
export * from "./sdk";
|
|
18
|
-
export * from "./trading";
|
|
19
|
-
export * from "./validation";
|
|
20
|
-
export * from "./vault";
|
|
21
|
-
export * from "./websocket";
|