Developers
Integration overview
This page describes AXIS DEX building blocks, where to start for your use case and a first working snippet.
What you can build#
AXIS keeps orders and settlement on-chain and leaves order selection to the apps that submit trades. On top of that split you can build:
- Wallet swaps and limit orders. Users keep their tokens in their own account and sign one transaction per trade.
- Trading interfaces with an orderbook, a depth chart, candles, recent trades and order entry.
- Market making strategies that post ladders of limit orders and requote them in place.
- Bots and arbitrage, including
crossfill, which pays the caller the spread of a crossed book. - Keepers that keep oracle prices, oracle feed access and the contract lifetime current.
- Routers, indexers and analytics built on the open-source indexer and the contract events.
- Protocols on top of AXIS, such as stop-loss and take-profit orders, market-making vaults, index baskets or RFQ and OTC trading. Every trading function takes the trader as an
Address, so another Soroban contract can own orders and trade.
Building blocks#
| Component | What it does | Links |
|---|---|---|
| The AXIS contract | Soroban smart contract. Stores orders, checks the price and the maker backing of every order a caller lists, and settles fills with transfer_from within the call: the taker pays makers directly, the makers' assets pass through the contract to the taker. Holds no user funds between calls. |
axis-markets/orderbook |
@axis-markets/client |
JavaScript client (MIT). Axis, AxisMarket and AxisAccount keep live state and trade with automatic allowance handling. AxisContractClient wraps the contract calls. AxisApiClient and AxisStreamClient talk to the AXIS API. |
axis-markets/js-client, npm |
@axis-markets/indexer |
Embeddable Node library (MIT). Rebuilds the book from contract events, tracks the backing of every maker and serves a read-only HTTP API. | axis-markets/indexer, npm |
| The AXIS API | Hosted REST and WebSocket service run by AXIS. Embeds the indexer and adds quotes (routing), depth, candles and a 24h ticker. | Testnet: https://demo-api.axis.markets and wss://demo-api.axis.markets/ws |
The contract never searches for liquidity. The app that builds a trade picks the orders to cross, usually from an AXIS API quote, and lists their IDs in the call. The contract checks every listed order, settles the ones it can fill and skips the rest. Architecture shows how the pieces fit together.
Where to start#
| You are building | Use | Start with |
|---|---|---|
| A wallet with swaps and order placement | AxisAccount, or AxisApiClient with AxisContractClient |
Wallet integration |
| A trading interface | Axis and AxisMarket streams for depth, trades, candles and the ticker, AxisAccount for the user's orders |
Axis, markets and accounts, WebSocket API |
| An app that uses the Classic DEX today | AXIS API endpoints in place of the Horizon orderbook, path and trade endpoints | Migrating from the Classic DEX |
| A market making strategy | AxisAccount.sell, buy and update, the account WebSocket channel |
Market making |
| A trading bot or arbitrage | The AXIS API or a self-hosted indexer, AxisContractClient (sell and buy for the contract's trade, plus swap and crossfill) |
Bots and arbitrage |
| A keeper | AxisContractClient (requote, subsidize, and keepalive, an ExtendFootprintTTL for the contract lifetime) |
Running a keeper |
| An indexer or analytics backend | @axis-markets/indexer with your own DataSource and HistoryStorage, the contract events |
Indexer, Events |
| An integration in another language | Contract functions through any Stellar RPC, the REST API | Functions, REST API |
Quick start#
Install the JS client and its Stellar SDK peer dependency. It runs on Node 22+ and in modern browsers.
pnpm add @axis-markets/client @stellar/stellar-sdk
Connect to Testnet and ask the AXIS API what 10 XLM buys in USDC:
import {Axis} from '@axis-markets/client'
import {Networks} from '@stellar/stellar-sdk'
const axis = new Axis({
apiUrl: 'https://demo-api.axis.markets',
rpcUrl: 'https://soroban-testnet.stellar.org',
networkPassphrase: Networks.TESTNET
})
await axis.connect() // the contract address comes from the AXIS API
const quote = await axis.api.quoteSell({sellingAsset: 'XLM', buyingAsset: 'USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5', amount: '100000000'})
console.log(quote.status, quote.paths[0]?.bought) // USDC base units received for 10 XLM
axis.close()
Amounts are integer base units: 1 XLM is 10,000,000 base units. After connect(), axis.markets holds every open market and axis.frozen tells whether trading is suspended. rpcUrl is needed to submit transactions, both trades and keeper calls. Getting started continues with signing and placing orders.
Important
networkPassphrase defaults to Pubnet in both Axis and AxisContractClient. Always pass Networks.TESTNET on Testnet, otherwise transactions are signed for the wrong network.
Networks#
AXIS runs on Testnet. Mainnet is not deployed yet. Contract IDs, asset contracts and endpoints are listed in Networks and deployments. The AXIS app is a Testnet trading UI you can use to create counter orders while you test your integration.
Read next#
- Architecture: the layers, the data flow and the trust boundaries.
- Contract design: how orders, backing and settlement work on-chain.
- Design rationale: why AXIS is built this way and which trade-offs it accepts.