Top SitesAlcor Exchange | Multi-Venue DeFi Trading Terminal

Machine Readiness

Stored receipt and evidence

Overall

20

Readable

65

Callable

0

Commerce

0

Payment

0

Machine Access

Inspect the site's MCP endpoint

Open MCP explorer

DialtoneApp can scan the stored discovery files for this domain, try the MCP initialize handshake, and show the raw protocol transcript.

Purchase boundary

read only

Control boundary

unknown

Payment rails

None

Payment providers

None

Payment methods

None

Payment protocols

None

Payment assets

None

Payment networks

None

Capabilities

None

Verified payment surface

No

Crypto only

No

Readable docs

robots, llms

Products

0

Variants

0

Priced variants

0

Currencies

0

Offers

0

Priced offers

0

Priced actions

0

Samples

Offer samples

No stored offer samples.

Samples

Action samples

No stored action samples.

Samples

Product samples

No stored product samples.

Document

robots.txt

Open robots.txt
User-Agent: *
Disallow: /auth/
Disallow: /debug
Disallow: /kit
Disallow: /test-*

Sitemap: https://alcor.exchange/sitemap.xml

Document

llms.txt

Open llms.txt
# Alcor Exchange

> Multi-venue trading terminal for DeFi on Antelope chains (WAX, XPR Network, EOS) and Hyperliquid.

Alcor Exchange is a unified trading interface that provides access to perpetual futures and spot trading on Hyperliquid, as well as AMM-based token swaps, spot orderbook trading, liquid staking, and OTC on Antelope-based blockchains (WAX, XPR Network, EOS).

Website: https://alcor.exchange
Developer docs: https://docs.alcor.exchange
REST API reference: https://api.alcor.exchange
WharfKit SDK: https://wharfkit.com (recommended for Antelope chain integration)

---

## URL Structure

```
https://alcor.exchange/v/{venueId}/{productId}/...
```

- **Venues:** `wax`, `xpr`, `eos`, `hyperliquid`
- **Products:** `spot`, `perp`, `swap`, `analytics`, `portfolio`

### Examples
- `/v/hyperliquid/perp/BTC` — BTC perpetual on Hyperliquid
- `/v/hyperliquid/perp/ETH` — ETH perpetual on Hyperliquid
- `/v/wax/swap` — Token swap on WAX
- `/v/wax/spot` — Spot orderbook on WAX
- `/v/xpr/swap` — Token swap on XPR Network
- `/v/eos/swap` — Token swap on EOS

---

## Networks & Contract Addresses

### WAX Mainnet

- **Chain ID:** `1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4`
- **RPC Endpoints:**
  - `https://wax-api.alcor.exchange` (primary)
  - `https://wax.greymass.com`
  - `https://wax.eosrio.io`
- **Explorer:** https://waxblock.io
- **Alcor API:** https://wax.alcor.exchange/api/v2
- **LightAPI:** https://wax.light-api.net

**Contracts:**
| Contract | Address | Purpose |
|----------|---------|---------|
| DEX (Orderbook) | `alcordexmain` | Spot orderbook trading |
| Swap AMM | `swap.alcor` | AMM token swaps |
| USDT (stablecoin) | `usdt.alcor` | USD stablecoin (symbol: USDT) |
| System Token | `eosio.token` | WAX native token (symbol: WAX) |
| Liquid Staking | `liquid.alcor` | Stake WAX → LSW |
| LSW Token | `lsw.alcor` | Liquid Staked WAX (symbol: LSW, 8 decimals) |
| OTC Swap | `alcorotcswap` | Over-the-counter trading |
| Account Creator | `acc.alcor` | Create WAX accounts (min 40 WAX) |

### XPR Network (Proton)

- **Chain ID:** `384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0`
- **RPC Endpoints:**
  - `https://proton-api.alcor.exchange` (primary)
  - `https://proton.greymass.com`
  - `https://proton.eosusa.io`
- **Explorer:** https://explorer.xprnetwork.org
- **Alcor API:** https://proton.alcor.exchange/api/v2
- **LightAPI:** https://proton.light-api.net

**Contracts:**
| Contract | Address | Purpose |
|----------|---------|---------|
| DEX (Orderbook) | `alcor` | Spot orderbook trading |
| Swap AMM | `swap.alcor` | AMM token swaps |
| XUSDT (stablecoin) | `xtokens` | USD stablecoin (symbol: XUSDT) |
| XUSDC (stablecoin) | `xtokens` | USD stablecoin (symbol: XUSDC) |
| System Token | `eosio.token` | XPR native token (symbol: XPR) |
| OTC Swap | `alcorotc` | Over-the-counter trading |
| Account Creator | `acc.alcor` | Create XPR accounts (min 1000 XPR) |

### EOS Mainnet

- **Chain ID:** `aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906`
- **RPC Endpoints:**
  - `https://eos.greymass.com` (primary)
  - `https://eos.eosrio.io`
  - `https://api.eosn.io`
- **Explorer:** https://bloks.io
- **Alcor API:** https://eos.alcor.exchange/api/v2

**Contracts:**
| Contract | Address | Purpose |
|----------|---------|---------|
| DEX (Orderbook) | `alcordexmain` | Spot orderbook trading |
| Swap AMM | `swap.alcor` | AMM token swaps |
| USDT (stablecoin) | `tethertether` | USD stablecoin (symbol: USDT) |
| System Token | `eosio.token` | EOS native token (symbol: EOS) |
| OTC Swap | `alcorotcswap` | Over-the-counter trading |

### Hyperliquid

- **Info API:** https://api.hyperliquid.xyz/info
- **Exchange API:** https://api.hyperliquid.xyz/exchange
- **WebSocket:** wss://api.hyperliquid.xyz/ws
- **Docs:** https://hyperliquid.gitbook.io/hyperliquid-docs

**EVM Addresses (Arbitrum):**
| Address | Purpose |
|---------|---------|
| `0x2df1c51e09aecf9cacb7bc98cb1742757f163df7` | Bridge contract (deposit USDC here) |
| `0xaf88d065e77c8cC2239327C5EDb3A432268e5831` | USDC token on Arbitrum |

**Signing & Execution:**
- **Signing chain:** Arbitrum (chainId `42161` / `0xa4b1`)
- **L1 order actions:** EIP-712 domain with chainId `1337` (phantom agent pattern)
- **Execution chain:** Hyperliquid L1 (off-chain, not EVM)

---

## Trading on Hyperliquid

Alcor Exchange provides a convenient UI for trading on Hyperliquid — one of the leading perpetuals DEXs. Users can trade perpetual markets (BTC, ETH, SOL, and 30+ others) and spot pairs with leverage.

**Features available via Alcor UI:**
- Market and limit orders
- Take Profit / Stop Loss
- Bracket orders (TP + SL in one)
- Scale orders (ladder into a position)
- TWAP execution
- One-click trading (no per-order wallet popups after initial approval)

**Trading flow:**
1. Connect an EVM wallet (MetaMask, WalletConnect, etc.)
2. Deposit USDC to the Hyperliquid bridge on Arbitrum: `0x2df1c51e09aecf9cacb7bc98cb1742757f163df7`
3. Approve trading once (signs a one-time agent key)
4. Place orders without further wallet interactions

**Deposit options (via Alcor UI):**
- USDC on Arbitrum → bridge direct (< 1 min, min 5 USDC)
- BTC on Bitcoin → via Unit Protocol (~30 min, min 0.0003 BTC)
- ETH on Ethereum → via Unit Protocol (~5 min, min 0.007 ETH)
- SOL on Solana → via Unit Protocol (~1 min, min 0.12 SOL)
- ENA, BONK, FARTCOIN, PUMP, SPX, 2Z, XPL, MON also supported

---

## WharfKit SDK Setup (Antelope Chains)

WharfKit is the recommended SDK for building applications on Antelope chains (WAX, EOS, XPR). Install and configure:

```bash
npm install @wharfkit/session @wharfkit/contract @wharfkit/antelope @wharfkit/wallet-plugin-privatekey
```

```typescript
import { Session } from '@wharfkit/session'
import { ContractKit } from '@wharfkit/contract'
import { APIClient } from '@wharfkit/antelope'

// 1. Create API client for your chain
const client = new APIClient('https://wax-api.alcor.exchange') // or eos.greymass.com, proton-api.alcor.exchange

// 2. Create session (for signing transactions)
const session = new Session({
  actor: 'myaccount',
  permission: 'active',
  chain: {
    id: '1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4', // WAX
    url: 'https://wax-api.alcor.exchange'
  },
  walletPlugin: new WalletPluginPrivateKey('5K...')  // or use other wallet plugins
})

// 3. ContractKit (for reading tables, building actions)
const contractKit = new ContractKit({ client })
```

**Chain IDs for session config:**
| Chain | Chain ID |
|-------|----------|
| WAX | `1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4` |
| EOS | `aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906` |
| XPR Network | `384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0` |

---

## Swap (Alcor AMM)

AMM-based token swaps on Antelope chains. Powered by Alcor liquidity pools with multi-hop routing.

### Pool Fee Tiers
| Fee | Use case |
|-----|---------|
| 0.05% | Stable/correlated pairs |
| 0.3% | Standard pairs |
| 1% | Exotic/volatile pairs |

### Token ID Formats

**API format** (for URL params and API calls): `symbol-contract` (lowercase)
- Examples: `wax-eosio.token`, `tlm-alien.worlds`, `usdt-usdt.alcor`, `xusdt-xtokens`

**Standard key** (internal): `contract:SYMBOL`
- Examples: `eosio.token:WAX`, `alien.worlds:TLM`, `usdt.alcor:USDT`

### Get Swap Route

```
GET {apiUrl}/swapRouter/getRoute
```

Query parameters:
| Param | Type | Description |
|-------|------|-------------|
| `trade_type` | string | `EXACT_INPUT` or `EXACT_OUTPUT` |
| `input` | string | Input token in API format, e.g. `wax-eosio.token` |
| `output` | string | Output token in API format, e.g. `usdt-usdt.alcor` |
| `amount` | string | Amount as string |
| `slippage` | number | Slippage tolerance, e.g. `0.5` for 0.5% |
| `v2` | bool | Always pass `true` for v2 routing |
| `receiver` | string | (optional) Receiver account name |
| `maxHops` | number | (optional) Max hops in route |

Example:
```
GET https://wax.alcor.exchange/api/v2/swapRouter/getRoute?trade_type=EXACT_INPUT&input=wax-eosio.token&output=usdt-usdt.alcor&amount=100&slippage=0.5&v2=true
```

### Token List

```
GET {apiUrl}/tokens
```

Returns all tokens with decimals, USD prices, and metadata.

### Candles (Swap Price History)

```
GET {apiUrl}/swap/candles?tokenA={id}&tokenB={id}&resolution={resolution}&from={ms}&to={ms}&limit={n}
```

| Param | Description |
|-------|-------------|
| `tokenA` / `tokenB` | Token IDs in API format |
| `resolution` | Candle interval: `1m`, `5m`, `15m`, `1h`, `4h`, `1d` |
| `from` / `to` | Unix timestamps in milliseconds |
| `limit` | Max number of candles |

### Execute Swap (cleos / HTTP)

The swap is a single on-chain `transfer` action. The route API provides the exact `memo` and `input` quantity — just send them.

**Step 1 — get route:**
```bash
curl "https://wax.alcor.exchange/api/v2/swapRouter/getRoute?\
trade_type=EXACT_INPUT&input=wax-eosio.token&output=tlm-alien.worlds\
&amount=100&slippage=0.5&v2=true&receiver=myaccount"
```

Response (relevant fields):
```json
{
  "input":  "100.00000000 WAX",
  "output": "12345.00000000 TLM",
  "minReceived": "12283.78 TLM",
  "memo":   "2,<pool_ids>,<min_received>@<contract>,myaccount",
  "swaps": [{ "input": "100.00000000 WAX", "memo": "...", ... }]
}
```

**Step 2 — execute (cleos):**
```bash
# Transfer input token to swap.alcor with memo from route response
cleos -u https://wax-api.alcor.exchange push action eosio.token transfer \
  '["myaccount","swap.alcor","100.00000000 WAX","<memo from route>"]' \
  -p myaccount@active
```

**Step 2 — execute (HTTP push_transaction):**
```bash
curl -X POST https://wax-api.alcor.exchange/v1/chain/push_transaction \
  -H 'Content-Type: application/json' \
  -d '{
    "signatures": ["..."],
    "compression": false,
    "packed_context_free_data": "",
    "packed_trx": "..."
  }'
```

> For multi-split routes the response contains multiple objects in `swaps[]` — submit one transfer action per swap, all in the same transaction.

### Execute Swap (WharfKit)

```typescript
// Step 1 — get route from Alcor API
const params = new URLSearchParams({
  trade_type: 'EXACT_INPUT',
  input: 'wax-eosio.token',
  output: 'usdt-usdt.alcor',
  amount: '100',
  slippage: '0.5',
  v2: 'true',
  receiver: String(session.actor)
})
const route = await fetch(`https://wax.alcor.exchange/api/v2/swapRouter/getRoute?${params}`)
  .then(r => r.json())

// Step 2 — build transfer actions from route.swaps[]
// Single-route swap:
const result = await session.transact({
  action: {
    account: 'eosio.token',          // input token contract
    name: 'transfer',
    authorization: [session.permissionLevel],
    data: {
      from: session.actor,
      to: 'swap.alcor',              // AMM contract
      quantity: route.input,          // e.g. "100.00000000 WAX"
      memo: route.memo               // route memo from API
    }
  }
})

// Multi-split route (when route.swaps has multiple entries):
const actions = route.swaps.map(swap => ({
  account: swap.contract || 'eosio.token',  // input token contract
  name: 'transfer',
  authorization: [session.permissionLevel],
  data: {
    from: session.actor,
    to: 'swap.alcor',
    quantity: swap.input,
    memo: swap.memo
  }
}))
const result = await session.transact({ actions })
```

---

## Liquidity Management (AMM)

Alcor AMM uses concentrated liquidity (similar to Uniswap v3). Positions have a tick range (`tickLower`, `tickUpper`) defining the price range.

**Contract:** `swap.alcor` (all chains)

### Add Liquidity (WharfKit)

Adding liquidity requires 3 actions in one transaction:
1. Transfer token A to `swap.alcor` with memo `deposit`
2. Transfer token B to `swap.alcor` with memo `deposit`
3. Call `addliquid` on `swap.alcor`

```typescript
const poolId = 5                      // pool ID from GET /swap/pools
const owner = String(session.actor)

const result = await session.transact({
  actions: [
    // 1. Deposit token A
    {
      account: 'eosio.token',         // tokenA contract
      name: 'transfer',
      authorization: [session.permissionLevel],
      data: {
        from: session.actor,
        to: 'swap.alcor',
        quantity: '100.00000000 WAX',  // tokenA amount
        memo: 'deposit'
      }
    },
    // 2. Deposit token B
    {
      account: 'usdt.alcor',          // tokenB contract
      name: 'transfer',
      authorization: [session.permissionLevel],
      data: {
        from: session.actor,
        to: 'swap.alcor',
        quantity: '50.000000 USDT',    // tokenB amount
        memo: 'deposit'
      }
    },
    // 3. Add liquidity to pool
    {
      account: 'swap.alcor',
      name: 'addliquid',
      authorization: [session.permissionLevel],
      data: {
        poolId: poolId,
        owner: owner,
        tokenADesired: '100.00000000 WAX',
        tokenBDesired: '50.000000 USDT',
        tickLower: -100,               // lower tick of price range
        tickUpper: 100,                // upper tick of price range
        tokenAMin: '99.00000000 WAX',  // slippage-adjusted minimum
        tokenBMin: '49.500000 USDT',   // slippage-adjusted minimum
        deadline: 0
      }
    }
  ]
})
```

> **Tick range:** Defines the price range. Use pool data from `GET /swap/pools/{id}` to find current tick, and calculate appropriate range. Tighter range = more capital efficiency but more impermanent loss risk.

### Remove Liquidity (WharfKit)

Removing liquidity uses `subliquid`. For full removal, also call `collect`.

```typescript
// Partial removal (e.g., 50% of position liquidity)
const result = await session.transact({
  action: {
    account: 'swap.alcor',
    name: 'subliquid',
    authorization: [session.permissionLevel],
    data: {
      poolId: 5,
      owner: String(session.actor),
      liquidity: '500000000',           // liquidity amount to remove (BigInt string)
      tickLower: -100,
      tickUpper: 100,
      tokenAMin: '0.00000000 WAX',      // minimum tokenA to receive
      tokenBMin: '0.000000 USDT',       // minimum tokenB to receive
      deadline: 0
    }
  }
})

// Full removal — subliquid + collect in one transaction
const result = await session.transact({
  actions: [
    {
      account: 'swap.alcor',
      name: 'subliquid',
      authorization: [session.permissionLevel],
      data: {
        poolId: 5,
        owner: String(session.actor),
        liquidity: '1000000000',        // full position liquidity
        tickLower: -100,
        tickUpper: 100,
        tokenAMin: '0.00000000 WAX',
        tokenBMin: '0.000000 USDT',
        deadline: 0
      }
    },
    {
      account: 'swap.alcor',
      name: 'collect',
      authorization: [session.permissionLevel],
      data: {
        poolId: 5,
        owner: String(session.actor),
        recipient: String(session.actor),
        tickLower: -100,
        tickUpper: 100,
        tokenAMax: '0.00000000 WAX',
        tokenBMax: '0.000000 USDT'
      }
    }
  ]
})
```

### Collect Fees (WharfKit)

Collect accrued trading fees without removing liquidity. Uses `subliquid` with `liquidity: 0` followed by `collect`.

```typescript
const result = await session.transact({
  actions: [
    {
      account: 'swap.alcor',
      name: 'subliquid',
      authorization: [session.permissionLevel],
      data: {
        poolId: 5,
        owner: String(session.actor),
        liquidity: 0,                   // 0 = don't remove any liquidity
        tickLower: -100,
        tickUpper: 100,
        tokenAMin: '0.00000000 WAX',
        tokenBMin: '0.000000 USDT',
        deadline: 0
      }
    },
    {
      account: 'swap.alcor',
      name: 'collect',
      authorization: [session.permissionLevel],
      data: {
        poolId: 5,
        owner: String(session.actor),
        recipient: String(session.actor),
        tickLower: -100,
        tickUpper: 100,
        tokenAMax: '0.00000000 WAX',    // pass zero-assets to collect all
        tokenBMax: '0.000000 USDT'
      }
    }
  ]
})
```

### Get Position Data

```typescript
// Via Alcor API
const positions = await fetch('https://wax.alcor.exchange/api/v2/account/myaccount/positions')
  .then(r => r.json())

// Via on-chain table (ContractKit)
const swapContract = await contractKit.load('swap.alcor')
const poolTable = swapContract.table('pairs', 'swap.alcor')
const pool = await poolTable.get(5)  // pool ID
console.log('Current tick:', pool.currSlot)
console.log('Liquidity:', pool.liquidity)
```

---

## Spot Orderbook Trading (cleos / HTTP)

Orders are placed via a `transfer` action on the **token contract** — there is no separate "place order" action. The DEX contract (`alcordexmain` on WAX/EOS, `alcor` on XPR) interprets the memo as the desired output amount.

### Memo format

```
{amount} {SYMBOL}@{contract}
```

- **Limit order:** desired output amount (price × size for buy; just size for sell)
- **Market order:** amount = `0` — fills at the best available price

### Limit BUY — send quote, receive base

Example: buy 100 TLM at 0.0008 WAX/TLM (send 0.08 WAX, want 100 TLM)

```bash
cleos -u https://wax-api.alcor.exchange push action eosio.token transfer \
  '["myaccount","alcordexmain","0.08000000 WAX","100.00000000 TLM@alien.worlds"]' \
  -p myaccount@active
```

### Limit SELL — send base, receive quote

Example: sell 100 TLM at 0.0008 WAX/TLM (send 100 TLM, want 0.08 WAX)

```bash
cleos -u https://wax-api.alcor.exchange push action alien.worlds transfer \
  '["myaccount","alcordexmain","100.00000000 TLM","0.08000000 WAX@eosio.token"]' \
  -p myaccount@active
```

### Market BUY — send quote, any price (memo amount = 0)

```bash
cleos -u https://wax-api.alcor.exchange push action eosio.token transfer \
  '["myaccount","alcordexmain","0.08000000 WAX","0.00000000 TLM@alien.worlds"]' \
  -p myaccount@active
```

### Market SELL — send base, any price (memo amount = 0)

```bash
cleos -u https://wax-api.alcor.exchange push action alien.worlds transfer \
  '["myaccount","alcordexmain","100.00000000 TLM","0.00000000 WAX@eosio.token"]' \
  -p myaccount@active
```

### Cancel order

Get `market_id` and `order_id` from `GET /markets/{id}/orderbook` or the open orders API.

```bash
# Cancel a buy order
cleos -u https://wax-api.alcor.exchange push action alcordexmain cancelbuy \
  '{"executor":"myaccount","market_id":99,"order_id":12345}' \
  -p myaccount@active

# Cancel a sell order
cleos -u https://wax-api.alcor.exchange push action alcordexmain cancelsell \
  '{"executor":"myaccount","market_id":99,"order_id":12345}' \
  -p myaccount@active
```

> On XPR Network replace `alcordexmain` with `alcor` and use the XPR RPC endpoint.

### Get open orders (HTTP)

```bash
# All open orders for an account on a market
curl "https://wax.alcor.exchange/api/v2/markets/99/orders?account=myaccount"
```

### Orderbook math reference

For a **limit BUY** of `size` base at `price` quote/base:
- `quantity` (sent) = `price × size` in quote token (round up to quote decimals)
- `memo` = `size` in base token @ base contract

For a **limit SELL** of `size` base at `price` quote/base:
- `quantity` (sent) = `size` in base token
- `memo` = `price × size` in quote token @ quote contract

Token amounts must be formatted as Antelope assets: `"N.DDDDDDDD SYMBOL"` — always with the exact number of decimal places the token uses (e.g. 8 for WAX/TLM, 6 for USDT).

### Place Orders (WharfKit)

```typescript
const dexContract = 'alcordexmain'  // WAX/EOS. Use 'alcor' for XPR Network

// Limit BUY: send quote token, memo = desired base amount
const buyResult = await session.transact({
  action: {
    account: 'eosio.token',           // quote token contract
    name: 'transfer',
    authorization: [session.permissionLevel],
    data: {
      from: session.actor,
      to: dexContract,
      quantity: '0.08000000 WAX',      // quote amount = price × size
      memo: '100.00000000 TLM@alien.worlds'  // desired base @ base_contract
    }
  }
})

// Limit SELL: send base token, memo = desired quote amount
const sellResult = await session.transact({
  action: {
    account: 'alien.worlds',          // base token contract
    name: 'transfer',
    authorization: [session.permissionLevel],
    data: {
      from: session.actor,
      to: dexContract,
      quantity: '100.00000000 TLM',    // base amount
      memo: '0.08000000 WAX@eosio.token'  // desired quote @ quote_contract
    }
  }
})

// Market BUY: memo amount = 0 (fills at best available price)
const marketBuy = await session.transact({
  action: {
    account: 'eosio.token',
    name: 'transfer',
    authorization: [session.permissionLevel],
    data: {
      from: session.actor,
      to: dexContract,
      quantity: '0.08000000 WAX',
      memo: '0.00000000 TLM@alien.worlds'  // zero = market order
    }
  }
})

// Market SELL: memo amount = 0
const marketSell = await session.transact({
  action: {
    account: 'alien.worlds',
    name: 'transfer',
    authorization: [session.permissionLevel],
    data: {
      from: session.actor,
      to: dexContract,
      quantity: '100.00000000 TLM',
      memo: '0.00000000 WAX@eosio.token'
    }
  }
})
```

### Cancel Orders (WharfKit)

```typescript
const dexContract = 'alcordexmain'  // WAX/EOS. Use 'alcor' for XPR

// Cancel a single buy order
await session.transact({
  action: {
    account: dexContract,
    name: 'cancelbuy',
    authorization: [session.permissionLevel],
    data: {
      executor: String(session.actor),
      market_id: 99,
      order_id: 12345
    }
  }
})

// Cancel a single sell order
await session.transact({
  action: {
    account: dexContract,
    name: 'cancelsell',
    authorization: [session.permissionLevel],
    data: {
      executor: String(session.actor),
      market_id: 99,
      order_id: 67890
    }
  }
})

// Cancel multiple orders in one transaction
const orders = [
  { type: 'buy', market_id: 99, order_id: 111 },
  { type: 'buy', market_id: 99, order_id: 222 },
  { type: 'sell', market_id: 99, order_id: 333 },
]
await session.transact({
  actions: orders.map(o => ({
    account: dexContract,
    name: o.type === 'buy' ? 'cancelbuy' : 'cancelsell',
    authorization: [session.permissionLevel],
    data: {
      executor: String(session.actor),
      market_id: o.market_id,
      order_id: o.order_id
    }
  }))
})
```

### Read Orderbook On-Chain (WharfKit ContractKit)

```typescript
const dexContract = await contractKit.load('alcordexmain')

// Get buy orders for market 99
const buyOrders = dexContract.table('buyorder', '99')  // scope = market_id
const buyCursor = buyOrders.query()
for await (const row of buyCursor) {
  console.log(`Order #${row.id}: ${row.bid} → ${row.ask} by ${row.account}`)
}

// Get sell orders for market 99
const sellOrders = dexContract.table('sellorder', '99')
const sellCursor = sellOrders.query()
for await (const row of sellCursor) {
  console.log(`Order #${row.id}: ${row.bid} → ${row.ask} by ${row.account}`)
}

// Get all markets
const markets = dexContract.table('markets', 'alcordexmain')
const marketCursor = markets.query()
for await (const market of marketCursor) {
  console.log(`Market #${market.id}: ${market.quote_token.sym} / ${market.base_token.sym}`)
}
```

---

## Alcor REST API

Full interactive reference: https://api.alcor.exchange
Developer docs: https://docs.alcor.exchange/developers-api

Each chain has its own base URL (`{apiUrl}`):
- WAX: `https://wax.alcor.exchange/api/v2`
- XPR Network: `https://proton.alcor.exchange/api/v2`
- EOS: `https://eos.alcor.exchange/api/v2`

### Tokens

| Endpoint | Description |
|----------|-------------|
| `GET {apiUrl}/tokens` | All tokens with decimals, USD prices, metadata |
| `GET {apiUrl}/tokens/{token_id}` | Single token price. `token_id` = `symbol-contract` (e.g. `wax-eosio.token`) |
| `GET {apiUrl}/tokens/{token_id}/logo` | Token logo (PNG) |

### Spot Orderbook Markets

| Endpoint | Description |
|----------|-------------|
| `GET {apiUrl}/markets` | All spot orderbook markets |
| `GET {apiUrl}/markets/{id}` | Single market (tokens, price, 24h volume) |
| `GET {apiUrl}/markets/{id}/deals` | Recent trades. Params: `limit` (default 200) |
| `GET {apiUrl}/markets/{id}/charts` | OHLCV candles. Params: `resolution` (1/5/15/30/60/240/1440), `from`, `to`, `limit` |
| `GET {apiUrl}/markets/{id}/orderbook` | Current orderbook (bids + asks). Params: `depth` (default 300) |
| `GET {apiUrl}/markets/{id}/orders` | Open orders. Params: `account` |

### Tickers (CoinGecko-compatible)

| Endpoint | Description |
|----------|-------------|
| `GET {apiUrl}/pairs` | All trading pairs. Params: `base`, `target` |
| `GET {apiUrl}/tickers` | All market tickers with 24h stats |
| `GET {apiUrl}/tickers/{ticker_id}` | Single ticker (price, volume, bid/ask, liquidity) |
| `GET {apiUrl}/tickers/{ticker_id}/orderbook` | Orderbook as `[price, quantity][]` arrays. Params: `depth` |
| `GET {apiUrl}/tickers/{ticker_id}/latest_trades` | Recent trades. Params: `limit` (default 300) |
| `GET {apiUrl}/tickers/{ticker_id}/historical_trades` | Historical trades. Params: `type`, `limit`, `step`, `from`, `to` |
| `GET {apiUrl}/tickers/{ticker_id}/charts` | Candles. Params: `resolution` (1/5/15/30/60/240/1D/1W/1M), `from`, `to`, `limit` |

### Swap (AMM)

| Endpoint | Description |
|----------|-------------|
| `GET {apiUrl}/swap/pools` | All AMM pools with TVL, volumes, fees |
| `GET {apiUrl}/swap/pools/{pool_id}` | Single pool details |
| `GET {apiUrl}/swap/pools/{pool_id}/swaps` | Pool swap history. Params: `from`, `to`, `recipient`, `sender`, `limit`, `skip` |
| `GET {apiUrl}/swap/pools/{pool_id}/positions` | Pool LP positions |
| `GET {apiUrl}/swapRouter/getRoute` | Swap routing (see Swap section above for params) |
| `GET {apiUrl}/swap/candles` | Price candles for swap pairs. Params: `tokenA`, `tokenB`, `resolution`, `from`, `to`, `limit` |

### Account

| Endpoint | Description |
|----------|-------------|
| `GET {apiUrl}/account/{account}/deals` | Spot trade history. Params: `from`, `to`, `limit`, `skip`, `market` |
| `GET {apiUrl}/account/{account}/positions` | All AMM LP positions with fees, value, P&L |
| `GET {apiUrl}/account/{account}/positions-history` | Position transaction history. Params: `limit`, `skip` |
| `GET {apiUrl}/account/{account}/swap-history` | Swap history. Params: `limit`, `skip` |

### Analytics

| Endpoint | Description |
|----------|-------------|
| `GET {apiUrl}/analytics/global` | Platform stats: TVL, volumes, fees, users. Params: `resolution` (1D/1W/1M) |

### CPU Payer (WAX only)

Free CPU for Alcor transactions. Rate limits: 500/hr per IP, 300/hr per account.

| Endpoint | Description |
|----------|-------------|
| `POST {apiUrl}/../cpu/status` | Check CPU payer availability |
| `POST {apiUrl}/../cpu/cosign` | Co-sign transaction (body: `{ serializedTransaction: "hex..." }`) |

Allowed contracts: `alcordexmain`, `swap.alcor`, `otc.alcor`, `alcorotcswap`, `liquid.alcor`

### WebSocket (Socket.IO)

Connect to `https://alcor.exchange` via Socket.IO.

```javascript
// Subscribe to real-time deals
socket.emit('subscribe', { room: 'deals', params: { chain: 'wax', market: 99 } })
socket.on('new_deals', (deals) => { /* { time, ask, bid, type, unit_price, trx_id } */ })

// Subscribe to orderbook updates
socket.emit('subscribe', { room: 'orderbook', params: { chain: 'wax', market: 99, side: 'buy' } })
socket.on('orderbook_buy', (data) => { /* [[price, quantity, accumulated], ...] */ })

// Subscribe to account events (order matches)
socket.emit('subscribe', { room: 'account', params: { chain: 'wax', name: 'myaccount' } })
```

### Contract Tables (on-chain queries)

Query via `POST /v1/chain/get_table_rows` on any Antelope RPC endpoint.

**`alcordexmain::markets`** — all spot markets
```json
{ "code": "alcordexmain", "table": "markets", "scope": "alcordexmain", "limit": 100 }
```
Fields: `id`, `base_token`, `quote_token`, `min_buy`, `min_sell`, `fee`

**`alcordexmain::buyorder`** / **`alcordexmain::sellorder`** — open orders for a market
```json
{ "code": "alcordexmain", "table": "buyorder", "scope": "{market_id}", "limit": 100 }
```
Fields: `id`, `account`, `bid`, `ask`, `unit_price`, `timestamp`
Index `"byaccount"` to filter by trader.

**`swap.alcor::pairs`** — AMM liquidity pools
```json
{ "code": "swap.alcor", "table": "pairs", "scope": "swap.alcor", "limit": 100 }
```
Fields: `id`, `supply`, `pool1`, `pool2`, `fee`, `currSlot` (current tick), `liquidity`

---

## Liquid Staking (WAX only)

Stake WAX to receive LSW (Liquid Staked WAX) — a rebasing liquid staking token that earns WAX staking rewards while remaining tradeable.

- **Staking contract:** `liquid.alcor`
- **LSW token:** `lsw.alcor` (symbol: LSW, 8 decimals)
- **UI:** https://alcor.exchange/v/wax/swap (liquid staking section)

---

## OTC Trading

Peer-to-peer OTC swap contracts for large trades without slippage.

| Chain | Contract |
|-------|---------|
| WAX | `alcorotcswap` |
| XPR Network | `alcorotc` |
| EOS | `alcorotcswap` |

Document

llms-full.txt

Not stored for this site.