@0xmonaco/types 0.8.11 → 0.8.14

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.
@@ -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 `withdrawal_index`. 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,6 +18,12 @@ 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
@@ -23,21 +31,31 @@ export interface InitiateWithdrawalRequest {
23
31
  * (snake_case) form returned by the gateway.
24
32
  */
25
33
  export interface WithdrawalResponse {
26
- /** Allocated withdrawal index — matches `executeSignedWithdrawal.index` on-chain. */
34
+ /** Allocated withdrawal index — matches `executeWithdrawal.index` on-chain. */
27
35
  withdrawal_index: 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
+ vault_address: 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>;
43
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "0.8.11",
3
+ "version": "0.8.14",
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.14",
24
24
  "zod": "^4.1.12"
25
25
  },
26
26
  "peerDependencies": {