Skip to main content

Monaco Protocol SDK v0.7.8

Withdrawal Flow

The withdrawal flow has been updated to use a pre-signed calldata path through the backend. sdk.vault.withdraw() now posts to /api/v1/withdrawals to receive gateway-signed calldata and a withdrawalIndex, then submits the transaction on-chain via the wallet client.

Return type change

withdraw() now returns WithdrawResult instead of TransactionResult:
Store withdrawalIndex — you need it to retry a failed submission.

New method: retryWithdrawal

retryWithdrawal fetches the same gateway-signed calldata originally issued for that index and resubmits it. Safe to call multiple times — the matching engine is idempotent against duplicate submissions of a settled withdrawal.

Migration

If you only use hash or status from the return value, no code change is required. The new withdrawalIndex field is additive.

Position Endpoints — position_id Body Rejection

The API gateway now rejects unknown fields in JSON request bodies. As a result, position_id is no longer accepted in the body of:
  • POST /api/v1/positions/{id}/close
  • POST /api/v1/positions/{id}/add-margin
  • POST /api/v1/positions/{id}/reduce-margin
The position ID must be in the URL path only. SDK callers are unaffected — the TypeScript SDK has always derived the path from the positionId argument and never included it in the body. If you call these endpoints directly over HTTP, remove position_id from the request body:

Upgrade