Authentication

Approve PermitSingle budget

Changed on

Set a timed allowance budget for an operator (e.g. OperatorHub). The account grants the operator a notional USD spending budget, enabling the backend to execute orders on the account's behalf without per-order signatures. Required for TPSL (Take Profit / Stop Loss) orders.

Prerequisites:

  1. GET /v1/system/config — get operator_hub address (the operator to approve)
  2. GET /v1/auth/eip712-domain — get EIP-712 domain for signing
  3. GET /v1/nonce-state/{account} — get nonce_anchor and current_bitmap_index

Account signs PermitSingle (EIP-712):

PermitSingle(address account,address operator,uint96 budget,uint32 allowanceExpiry,uint48 nonceAnchor,uint8 nonceBitmap)

Struct hash: keccak256(abi.encode(PERMIT_SINGLE, account, operator, budget, allowanceExpiry, nonceAnchor, nonceBitmap))

The type string is hashed literally, so it must be copied verbatim — a single added space yields a different typehash and the signature will not recover.

Uses the EIP-712 domain from GET /v1/auth/eip712-domain.

Constraints:

  • budget must be > 0 (notional USD in WAD, 18 decimals, uint96)
  • allowanceExpiry must be in the future (unix timestamp in seconds)
  • Cannot overwrite an active (non-expired) allowance — call lockdownAllowance(operator) on the Authorization contract first, or wait for expiry
  • All submitted fields must exactly match the signed EIP-712 values

Budget management:

  • Each executed order consumes size × price (notional) from the budget
  • Query remaining budget: call getAllowance(account, operator) on the Authorization contract
  • Emergency revoke: call lockdownAllowance(operator) directly on the Authorization contract (msg.sender = account)
post/v1/auth/approve-single

Request

Request body

accountstring

Account address in hex format (0x...)

operatorstring

Operator address to approve (0x...)

budgetstring

Budget amount in WAD (uint96, 18 decimals)

allowance_expiryinteger

Unix timestamp when the allowance expires

nonce_anchorstring

Bitmap nonce anchor (uint48) from GetNonceState

nonce_bitmap_indexinteger

Bitmap index within the nonce anchor epoch (0-207)

signaturestring

EIP712 signature from account (65 bytes hex)

Example request

{
  "account": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "operator": "0x1234567890123456789012345678901234567890",
  "budget": "1000000000000000000000",
  "nonce_anchor": "0",
  "signature": "0x1234..."
}

Response

A successful response.

transaction_hashstring

Transaction hash of the approve single operation

successboolean

Whether the approve single succeeded

block_numberstring uint64

Block number where the transaction was confirmed

access_tokenstring

JWT access token for API authentication

refresh_tokenstring

JWT refresh token for silent token renewal

expires_ininteger

Access token time-to-live in seconds

Example response

{
  "transaction_hash": "0xabcd1234...",
  "block_number": "12345678"
}

Changes