citrex API documentation

General Info

citrex is available with Rest API and Websocket.

If anything is unclear or not explained please inform us immediately and we will fix it.

The docs are split into:

  • Constructing EIP712 signatures - how to build EIP712 signature for API authentication
  • citrex Public Rest - public endpoints that require no authentication
  • citrex Auth Rest - endpoints that require authentication either via login OR through providing an EIP712 SignedAuthentication signature signed by the account owner
  • citrex Websockets - see the citrex websocket introduction

Endpoints

The following base endpoints are available:

Production

REST API: https://api.citrex.markets/v1

WEBSOCKET: https://api.citrex.markets/v1/ws/operate

Staging

REST API: https://api.staging.citrex.markets/v1

WEBSOCKET: https://api.staging.citrex.markets/v1/ws/operate

All endpoints return either a simple string, JSON object or array.

A word on signatures

All endpoints that check signatures rely on EIP712 signing. For details on EIP712 signing let us know what your preferred language is and we can direct you to the correct way of constructing these signatures. And make sure to read Constructing EIP712 signatures in the following section.

Here is the typed data definition in go:

var EIP712_TYPES = &apitypes.Types{
	"EIP712Domain": {
		{
			Name: "name", // ciao
			Type: "string",
		},
		{
			Name: "version", // "0.0.0"
			Type: "string",
		},
		{
			Name: "chainId", // 1329 - SEI mainnet
			Type: "uint256",
		},
		{
			Name: "verifyingContract", // OrderDispatch Sei Mainnet | 0x993543DC8BdFCba9fc7355d822108eF49dB6b9F9
			Type: "address",
		},
	},
	"LoginMessage": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "message",
			Type: "string",
		},
		{
			Name: "timestamp",
			Type: "uint64",
		},
	},
	"Order": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "productId",
			Type: "uint32",
		},
		{
			Name: "isBuy",
			Type: "bool",
		},
		{
			Name: "orderType",
			Type: "uint8",
		},
		{
			Name: "timeInForce",
			Type: "uint8",
		},
		{
			Name: "expiration",
			Type: "uint64",
		},
		{
			Name: "price",
			Type: "uint128",
		},
		{
			Name: "quantity",
			Type: "uint128",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"CancelOrders": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "productId",
			Type: "uint32",
		},
	},
	"CancelOrder": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "productId",
			Type: "uint32",
		},
		{
			Name: "orderId",
			Type: "string",
		},
	},
	"ApproveSigner": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "approvedSigner",
			Type: "address",
		},
		{
			Name: "isApproved",
			Type: "bool",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"Deposit": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "asset",
			Type: "address",
		},
		{
			Name: "quantity",
			Type: "uint256",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"Withdraw": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
		{
			Name: "asset",
			Type: "address",
		},
		{
			Name: "quantity",
			Type: "uint128",
		},
		{
			Name: "nonce",
			Type: "uint64",
		},
	},
	"SignedAuthentication": {
		{
			Name: "account",
			Type: "address",
		},
		{
			Name: "subAccountId",
			Type: "uint8",
		},
	},
}

Endpoints for reading data require either one of the following forms of authentication:

  • Attaching a signature of account and subAccountId params
  • Logging in via the /v1/session/login endpoint and only using the required query params

All endpoints to update state require a signature in the request's body.