@0xmonaco/types 0.8.11 → 0.8.15
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/applications/requests.d.ts +15 -15
- package/dist/applications/responses.d.ts +57 -56
- package/dist/auth/responses.d.ts +2 -1
- package/dist/contracts/balances.d.ts +1 -1
- package/dist/delegated-agents/index.d.ts +22 -21
- package/dist/faucet/index.d.ts +4 -4
- package/dist/fees/index.d.ts +4 -4
- package/dist/fees/responses.d.ts +17 -17
- package/dist/fees/responses.js +20 -20
- package/dist/margin-accounts/index.d.ts +78 -46
- package/dist/market/index.d.ts +132 -129
- package/dist/positions/index.d.ts +67 -45
- package/dist/profile/index.d.ts +92 -89
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sub-accounts/index.d.ts +22 -21
- package/dist/trading/index.d.ts +6 -6
- package/dist/trading/orders.d.ts +20 -20
- package/dist/trading/responses.d.ts +79 -79
- package/dist/validation/margin-accounts.d.ts +47 -5
- package/dist/validation/margin-accounts.js +34 -8
- package/dist/validation/market.d.ts +1 -1
- package/dist/validation/market.js +1 -1
- package/dist/validation/positions.d.ts +11 -7
- package/dist/validation/positions.js +10 -6
- package/dist/validation/profile.d.ts +10 -10
- package/dist/validation/profile.js +10 -10
- package/dist/validation/trading.d.ts +17 -17
- package/dist/validation/trading.js +36 -36
- package/dist/validation/vault.d.ts +4 -0
- package/dist/validation/vault.js +1 -0
- package/dist/vault/index.d.ts +33 -12
- package/dist/vault/responses.d.ts +50 -12
- package/dist/websocket/events/balance-events.d.ts +2 -1
- package/dist/websocket/events/movement-events.d.ts +2 -1
- package/dist/whitelist/index.d.ts +4 -4
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +9 -2
- package/dist/wire/schema.d.ts +1323 -853
- package/dist/withdrawals/index.d.ts +83 -12
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Response types for vault operations.
|
|
5
5
|
*/
|
|
6
|
+
import type { Address } from "viem";
|
|
6
7
|
/**
|
|
7
8
|
* Response from a transaction.
|
|
8
9
|
*/
|
|
@@ -17,29 +18,66 @@ export interface TransactionResult {
|
|
|
17
18
|
receipt?: import("viem").TransactionReceipt;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
|
-
* Result of
|
|
21
|
+
* Result of a withdrawal.
|
|
21
22
|
*
|
|
22
23
|
* The API gateway allocates a `withdrawalIndex` via the matching engine and
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* authenticates against.
|
|
24
|
+
* debits the balance immediately. The executable `executeWithdrawal(...)`
|
|
25
|
+
* calldata only exists once the withdrawal's root is confirmed on-chain and its
|
|
26
|
+
* merkle proof is persisted; the SDK polls for it and submits it through the
|
|
27
|
+
* connected wallet.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* `
|
|
29
|
+
* `withdrawalIndex` is therefore ALWAYS present — even when the proof did not
|
|
30
|
+
* become available within the poll window. In that case `status` is
|
|
31
|
+
* `"awaiting_proof"` and no transaction was submitted (`hash`, `nonce`, and
|
|
32
|
+
* `receipt` are absent); the caller keeps `withdrawalIndex` and finishes the
|
|
33
|
+
* withdrawal later with `retryWithdrawal(withdrawalIndex)`. This is why the
|
|
34
|
+
* transaction fields are optional rather than inherited as required from
|
|
35
|
+
* [`TransactionResult`]: a debited-but-unproven withdrawal must never strand the
|
|
36
|
+
* index inside a thrown error.
|
|
32
37
|
*/
|
|
33
|
-
export interface WithdrawResult
|
|
34
|
-
/** Allocated withdrawal index — matches `
|
|
38
|
+
export interface WithdrawResult {
|
|
39
|
+
/** Allocated withdrawal index — matches `executeWithdrawal.index`. Always present. */
|
|
35
40
|
withdrawalIndex: number;
|
|
41
|
+
/**
|
|
42
|
+
* Outcome of the withdrawal:
|
|
43
|
+
* - `"awaiting_proof"` — index allocated and balance debited, but the merkle
|
|
44
|
+
* proof was not available within the poll window, so nothing was submitted
|
|
45
|
+
* on-chain. Call `retryWithdrawal(withdrawalIndex)` once the root confirms.
|
|
46
|
+
* - `"pending" | "confirmed" | "failed"` — the calldata was submitted on-chain;
|
|
47
|
+
* semantics match [`TransactionResult.status`].
|
|
48
|
+
*/
|
|
49
|
+
status: TransactionResult["status"] | "awaiting_proof";
|
|
50
|
+
/** Transaction hash — absent when `status === "awaiting_proof"`. */
|
|
51
|
+
hash?: string;
|
|
52
|
+
/** Nonce used for the on-chain submission — absent when `status === "awaiting_proof"`. */
|
|
53
|
+
nonce?: bigint;
|
|
54
|
+
/** Transaction receipt (only when `autoWait` is enabled and the tx was submitted). */
|
|
55
|
+
receipt?: import("viem").TransactionReceipt;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Controls how the SDK polls for a withdrawal's `executeWithdrawal` calldata
|
|
59
|
+
* while its merkle proof is not yet available (the withdrawal root has not been
|
|
60
|
+
* confirmed on-chain). The gateway returns 404 (row not persisted yet) or 409
|
|
61
|
+
* (proof not confirmed yet) until ready; the SDK retries on both.
|
|
62
|
+
*/
|
|
63
|
+
export interface WithdrawalRetryOptions {
|
|
64
|
+
/** Delay between polls, in milliseconds. Defaults to 5000. */
|
|
65
|
+
pollIntervalMs?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Maximum total time to wait for the proof, in milliseconds. Defaults to
|
|
68
|
+
* 300_000 (5 minutes). On timeout the SDK does not throw — `withdraw` /
|
|
69
|
+
* `retryWithdrawal` return `{ status: "awaiting_proof", withdrawalIndex }` so
|
|
70
|
+
* the caller can retry later. Pass `Infinity` to poll indefinitely until the
|
|
71
|
+
* proof is available.
|
|
72
|
+
*/
|
|
73
|
+
timeoutMs?: number;
|
|
36
74
|
}
|
|
37
75
|
/**
|
|
38
76
|
* Token balance information.
|
|
39
77
|
*/
|
|
40
78
|
export interface Balance {
|
|
41
79
|
/** Token address */
|
|
42
|
-
token:
|
|
80
|
+
token: Address;
|
|
43
81
|
/** Balance amount */
|
|
44
82
|
amount: bigint;
|
|
45
83
|
/** Formatted balance string */
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Types for real-time user balance update events.
|
|
5
5
|
* This is an authenticated channel - requires JWT token.
|
|
6
6
|
*/
|
|
7
|
+
import type { Address } from "viem";
|
|
7
8
|
/**
|
|
8
9
|
* Reason for the balance update
|
|
9
10
|
*/
|
|
@@ -13,7 +14,7 @@ export type BalanceUpdateReason = "lock" | "unlock" | "deposit" | "withdrawal" |
|
|
|
13
14
|
*/
|
|
14
15
|
export interface UserBalanceEventData {
|
|
15
16
|
/** Token contract address */
|
|
16
|
-
tokenAddress:
|
|
17
|
+
tokenAddress: Address;
|
|
17
18
|
/** Token symbol */
|
|
18
19
|
tokenSymbol: string | null;
|
|
19
20
|
/** Available balance for trading (normalized) */
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Types for real-time user ledger movement events (deposits, withdrawals, transfers).
|
|
5
5
|
* This is an authenticated channel - requires JWT token.
|
|
6
6
|
*/
|
|
7
|
+
import type { Address } from "viem";
|
|
7
8
|
/**
|
|
8
9
|
* User movement event data containing ledger entry details
|
|
9
10
|
*/
|
|
@@ -15,7 +16,7 @@ export interface UserMovementEventData {
|
|
|
15
16
|
/** Transaction type (e.g., "deposit", "withdrawal", "trade") */
|
|
16
17
|
transactionType: string;
|
|
17
18
|
/** Token contract address */
|
|
18
|
-
tokenAddress:
|
|
19
|
+
tokenAddress: Address;
|
|
19
20
|
/** Token symbol */
|
|
20
21
|
symbol?: string;
|
|
21
22
|
/** Token decimals */
|
|
@@ -12,20 +12,20 @@ import type { BaseAPI } from "../api";
|
|
|
12
12
|
/** Body for a whitelist application. */
|
|
13
13
|
export interface SubmitWhitelistRequest {
|
|
14
14
|
/** Applicant wallet address (0x-prefixed, 40 hex chars) */
|
|
15
|
-
|
|
15
|
+
walletAddress: string;
|
|
16
16
|
/** Applicant email address */
|
|
17
17
|
email: string;
|
|
18
18
|
/** Applicant Twitter/X username (1-15 chars) */
|
|
19
|
-
|
|
19
|
+
twitterUsername?: string;
|
|
20
20
|
/** Applicant Telegram username (5-32 chars) */
|
|
21
|
-
|
|
21
|
+
telegramUsername?: string;
|
|
22
22
|
}
|
|
23
23
|
/** Response to a whitelist application. */
|
|
24
24
|
export interface SubmitWhitelistResponse {
|
|
25
25
|
/** Human-readable status message */
|
|
26
26
|
message: string;
|
|
27
27
|
/** Created user UUID (pending approval) */
|
|
28
|
-
|
|
28
|
+
userId: string | null;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Whitelist API interface. The submit endpoint is public (no auth required).
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
* hand-written SDK surface. CI regenerates it and fails on a diff, identical to
|
|
11
11
|
* the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
|
|
12
12
|
*/
|
|
13
|
-
export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "authenticate_backend", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_chart", "get_portfolio_stats", "get_position", "get_position_risk", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "
|
|
13
|
+
export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "authenticate_backend", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_chart", "get_portfolio_stats", "get_position", "get_position_risk", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
|
|
14
14
|
/** Union of every OpenAPI operationId in the spec. */
|
|
15
15
|
export type OperationId = (typeof OPERATION_IDS)[number];
|
package/dist/wire/operations.js
CHANGED
|
@@ -17,6 +17,7 @@ export const OPERATION_IDS = [
|
|
|
17
17
|
"batch_cancel_all",
|
|
18
18
|
"batch_cancel_all_by_pair",
|
|
19
19
|
"batch_cancel_orders",
|
|
20
|
+
"batch_close_all_positions",
|
|
20
21
|
"batch_create_orders",
|
|
21
22
|
"batch_replace_orders",
|
|
22
23
|
"cancel_conditional_order",
|
|
@@ -42,6 +43,8 @@ export const OPERATION_IDS = [
|
|
|
42
43
|
"get_order_by_id",
|
|
43
44
|
"get_orderbook_snapshot",
|
|
44
45
|
"get_orders",
|
|
46
|
+
"get_parent_margin_account_movements",
|
|
47
|
+
"get_parent_margin_account_summary",
|
|
45
48
|
"get_perp_market_config",
|
|
46
49
|
"get_perp_market_summary",
|
|
47
50
|
"get_portfolio_chart",
|
|
@@ -71,6 +74,7 @@ export const OPERATION_IDS = [
|
|
|
71
74
|
"list_funding_history",
|
|
72
75
|
"list_funding_payments",
|
|
73
76
|
"list_margin_accounts",
|
|
77
|
+
"list_pending_withdrawals",
|
|
74
78
|
"list_position_history",
|
|
75
79
|
"list_positions",
|
|
76
80
|
"list_sub_accounts_with_balances",
|
|
@@ -81,13 +85,16 @@ export const OPERATION_IDS = [
|
|
|
81
85
|
"replace_order",
|
|
82
86
|
"revoke_delegated_agent",
|
|
83
87
|
"revoke_session",
|
|
84
|
-
"simulate_auto_margin_order_risk",
|
|
85
88
|
"simulate_fees",
|
|
86
89
|
"simulate_order_risk",
|
|
90
|
+
"simulate_parent_margin_order_risk",
|
|
91
|
+
"simulate_risk_bucket_order_risk",
|
|
87
92
|
"submit_whitelist",
|
|
88
93
|
"transfer_collateral_from_margin_account",
|
|
89
|
-
"
|
|
94
|
+
"transfer_collateral_from_parent_margin_account",
|
|
90
95
|
"transfer_collateral_to_margin_account",
|
|
96
|
+
"transfer_collateral_to_parent_margin_account",
|
|
97
|
+
"transfer_collateral_to_risk_bucket",
|
|
91
98
|
"update_sub_account_limit",
|
|
92
99
|
"upsert_delegated_agent",
|
|
93
100
|
"verify_signature",
|