@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.
Files changed (40) hide show
  1. package/dist/applications/requests.d.ts +15 -15
  2. package/dist/applications/responses.d.ts +57 -56
  3. package/dist/auth/responses.d.ts +2 -1
  4. package/dist/contracts/balances.d.ts +1 -1
  5. package/dist/delegated-agents/index.d.ts +22 -21
  6. package/dist/faucet/index.d.ts +4 -4
  7. package/dist/fees/index.d.ts +4 -4
  8. package/dist/fees/responses.d.ts +17 -17
  9. package/dist/fees/responses.js +20 -20
  10. package/dist/margin-accounts/index.d.ts +78 -46
  11. package/dist/market/index.d.ts +132 -129
  12. package/dist/positions/index.d.ts +67 -45
  13. package/dist/profile/index.d.ts +92 -89
  14. package/dist/sdk/index.d.ts +3 -3
  15. package/dist/sub-accounts/index.d.ts +22 -21
  16. package/dist/trading/index.d.ts +6 -6
  17. package/dist/trading/orders.d.ts +20 -20
  18. package/dist/trading/responses.d.ts +79 -79
  19. package/dist/validation/margin-accounts.d.ts +47 -5
  20. package/dist/validation/margin-accounts.js +34 -8
  21. package/dist/validation/market.d.ts +1 -1
  22. package/dist/validation/market.js +1 -1
  23. package/dist/validation/positions.d.ts +11 -7
  24. package/dist/validation/positions.js +10 -6
  25. package/dist/validation/profile.d.ts +10 -10
  26. package/dist/validation/profile.js +10 -10
  27. package/dist/validation/trading.d.ts +17 -17
  28. package/dist/validation/trading.js +36 -36
  29. package/dist/validation/vault.d.ts +4 -0
  30. package/dist/validation/vault.js +1 -0
  31. package/dist/vault/index.d.ts +33 -12
  32. package/dist/vault/responses.d.ts +50 -12
  33. package/dist/websocket/events/balance-events.d.ts +2 -1
  34. package/dist/websocket/events/movement-events.d.ts +2 -1
  35. package/dist/whitelist/index.d.ts +4 -4
  36. package/dist/wire/operations.d.ts +1 -1
  37. package/dist/wire/operations.js +9 -2
  38. package/dist/wire/schema.d.ts +1323 -853
  39. package/dist/withdrawals/index.d.ts +83 -12
  40. package/package.json +2 -2
@@ -1,9 +1,11 @@
1
+ import type { Address } from "viem";
1
2
  import type { BaseAPI } from "../api";
2
3
  /**
3
4
  * Request body for `POST /api/v1/withdrawals`.
4
5
  *
5
6
  * Initiating a withdrawal debits the caller's balance via the matching engine
6
- * and returns pre-signed `executeSignedWithdrawal` calldata. Master accounts
7
+ * and allocates a `withdrawalIndex`. The executable calldata is fetched
8
+ * separately once the withdrawal root is confirmed on-chain. Master accounts
7
9
  * with the withdraw permission only.
8
10
  */
9
11
  export interface InitiateWithdrawalRequest {
@@ -16,28 +18,97 @@ export interface InitiateWithdrawalRequest {
16
18
  amount: string;
17
19
  /** On-chain address that will receive the withdrawal (EVM, 0x-prefixed). */
18
20
  destination: string;
21
+ /**
22
+ * Source ledger for the withdrawal. Defaults to `"spot"` when omitted.
23
+ * `"margin"` directly debits withdrawable collateral from the parent margin
24
+ * account.
25
+ */
26
+ source?: "spot" | "margin";
19
27
  }
20
28
  /**
21
29
  * Response shape shared by `POST /api/v1/withdrawals` and
22
- * `GET /api/v1/withdrawals/{withdrawalIndex}`. Field names match the wire
23
- * (snake_case) form returned by the gateway.
30
+ * `GET /api/v1/withdrawals/{withdrawalIndex}`. Field names match the camelCase
31
+ * wire form returned by the gateway.
24
32
  */
25
33
  export interface WithdrawalResponse {
26
- /** Allocated withdrawal index — matches `executeSignedWithdrawal.index` on-chain. */
27
- withdrawal_index: number;
34
+ /** Allocated withdrawal index — matches `executeWithdrawal.index` on-chain. */
35
+ withdrawalIndex: number;
28
36
  /** 0x-prefixed lowercase address of the vault contract the calldata is submitted to. */
29
- vault_address: string;
30
- /** 0x-prefixed ABI-encoded, signed `executeSignedWithdrawal(...)` calldata; submit as `tx.data`. */
37
+ vaultAddress: Address;
38
+ /**
39
+ * 0x-prefixed ABI-encoded `executeWithdrawal(...)` calldata; submit as
40
+ * `tx.data`. Empty from `initiateWithdrawal` (the merkle proof is not
41
+ * available until the withdrawal root is confirmed on-chain) — fetch it from
42
+ * `getWithdrawal` once ready.
43
+ */
31
44
  calldata: string;
32
45
  }
33
46
  /**
34
- * Low-level withdrawals API: allocate a withdrawal and fetch its signed
35
- * calldata. Does not submit on-chain — see the vault API for the high-level
36
- * flow that also broadcasts the transaction.
47
+ * Low-level withdrawals API: allocate a withdrawal and fetch its
48
+ * `executeWithdrawal` calldata. Does not submit on-chain — see the vault API
49
+ * for the high-level flow that polls for the calldata and broadcasts the
50
+ * transaction.
37
51
  */
38
52
  export interface WithdrawalsAPI extends BaseAPI {
39
- /** Initiate a withdrawal and return the signed calldata. Authenticated. */
53
+ /** Initiate a withdrawal and return its index. Authenticated. */
40
54
  initiateWithdrawal(request: InitiateWithdrawalRequest): Promise<WithdrawalResponse>;
41
- /** Re-fetch a previously-initiated withdrawal's signed calldata. Public — no auth. */
55
+ /**
56
+ * Fetch a withdrawal's `executeWithdrawal` calldata by index. Public — no
57
+ * auth. Throws an `APIError` (404 not-persisted-yet / 409 not-confirmed-yet)
58
+ * while the proof is not yet available.
59
+ */
42
60
  getWithdrawal(withdrawalIndex: number): Promise<WithdrawalResponse>;
61
+ /**
62
+ * List the caller's pending withdrawals (those still awaiting on-chain root
63
+ * confirmation). Authenticated and scoped to the caller. Newest first, paged.
64
+ */
65
+ listPendingWithdrawals(params?: ListPendingWithdrawalsParams): Promise<ListPendingWithdrawalsResponse>;
66
+ }
67
+ /** Query parameters for {@link WithdrawalsAPI.listPendingWithdrawals}. */
68
+ export interface ListPendingWithdrawalsParams {
69
+ /** Page number, 1-based. Defaults to 1. */
70
+ page?: number;
71
+ /** Items per page (1–100). Defaults to 20. */
72
+ pageSize?: number;
73
+ }
74
+ /**
75
+ * A single pending withdrawal in a {@link ListPendingWithdrawalsResponse}. A
76
+ * lightweight summary — the executable calldata is not included (it does not
77
+ * exist until the withdrawal is confirmed on-chain; fetch it via
78
+ * {@link WithdrawalsAPI.getWithdrawal} once ready).
79
+ */
80
+ export interface PendingWithdrawal {
81
+ /** Allocated withdrawal index — matches `executeWithdrawal.index` on-chain. */
82
+ withdrawalIndex: number;
83
+ /** UUID of the withdrawn asset. */
84
+ assetId: string;
85
+ /** Ticker symbol of the withdrawn asset. */
86
+ assetSymbol: string;
87
+ /**
88
+ * Raw token amount in the smallest unit (e.g. wei) as a stringified positive
89
+ * integer.
90
+ */
91
+ amount: string;
92
+ /** On-chain address that will receive the withdrawal. */
93
+ destination: Address;
94
+ /** Withdrawal lifecycle status; always `"pending"` for entries in this list. */
95
+ status: string;
96
+ /** RFC 3339 timestamp of when the withdrawal was initiated. */
97
+ createdAt: string;
98
+ }
99
+ /**
100
+ * Response for `GET /api/v1/withdrawals` — a page of the caller's pending
101
+ * withdrawals plus pagination metadata.
102
+ */
103
+ export interface ListPendingWithdrawalsResponse {
104
+ /** The page of pending withdrawals, newest first. */
105
+ withdrawals: PendingWithdrawal[];
106
+ /** Total number of pending withdrawals for the caller. */
107
+ total: number;
108
+ /** Current page number. */
109
+ page: number;
110
+ /** Items per page. */
111
+ pageSize: number;
112
+ /** Total number of pages. */
113
+ totalPages: number;
43
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "0.8.11",
3
+ "version": "0.8.15",
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": "0.8.11",
23
+ "@0xmonaco/contracts": "0.8.15",
24
24
  "zod": "^4.1.12"
25
25
  },
26
26
  "peerDependencies": {