ZeusError and carries a code and, where there is one, the underlying cause.
| Error | When |
|---|---|
InvalidAmount | An amount is negative, malformed or too precise, slippage is outside 0.01 to 5 percent, leverage is above 50.2x, or both or neither of size and leverage are given |
UnknownMarket | The market is not listed on this network |
NotApproved | A Router plugin or a token allowance is missing; the message names the setup call to run |
InsufficientExecutionFee | The contract refused the execution fee |
InsufficientCapacity | The pool cannot take the size on that side now |
MarketPaused | Trading or the market is paused |
LiquidityLocked | The ZLP to withdraw is still in its deposit cooldown |
RequestCancelled | The keeper cancelled the request; receipt holds the details |
ExecutionTimeout | No keeper outcome within 60 seconds; cancel() withdraws the request |
GatewayAuthError | The ZEUS API refused the key, or a gateway call was made without one |
UnknownRequest | track was asked about a request this client did not send, without submitTx |
RpcError | Any other node or API failure, with the revert reason or HTTP status |
import { InsufficientCapacity, RequestCancelled } from '@zeustrade/sdk'
try {
await zeus.trade.marketOpen(params)
} catch (error) {
if (error instanceof InsufficientCapacity) reduceSize()
else if (error instanceof RequestCancelled) console.log(error.receipt.cancelReason)
else throw error
}