Leyora
developers

Code against Leyora.

One open JSON API covers balances, payments, markets, launches and perps. Anything can read it, and any EVM wallet or an agent key can write to it.

Read the chain

No key is needed for the public routes. Requests and responses are JSON. Amounts travel as strings of base units, 9 decimals for HYPE (nano HYPE) and 6 for coins, and prices are decimal strings.

GET /api/chainChain id, head block, latest block hash, producer, settlement contract, door contract and receipt countopen
GET /api/blocksLatest block headers with tx root and state root, newest firstopen
GET /api/blocks/:idOne block by height or hash, with its transactions by hash, type and statusopen
GET /api/tx/:hashPublic view of a transaction: hash, type, status, blockopen
GET /api/checkpointsEvery receipt written to Elysium with its transaction hashopen
GET /api/search?q=A block height, block hash, tx hash or coin idopen
GET /api/coinsEvery coin with price, market cap, curve progress and opening stateopen
GET /api/coins/:idOne coinopen
GET /api/coins/:id/candlesPrice candles built from clears, 1m, 5m or 1hopen
GET /api/coins/:id/clearsOne clearing price per block: price, totals, buyers and sellersopen
GET /api/coins/:id/quoteEstimate a buy or sell as if you were alone in the batchopen
GET /api/perps/marketsPerps markets with mark price, open interest and max leverageopen
GET /api/perps/vaultVault size, shares, reserved HYPE, volume and feesopen
GET /api/priceHYPE in USD from Hyperliquid, as the chain sees itopen
GET /api/nonce/:pubkeyNext nonce for an accountopen
GET /api/streamLive stream of blocks, transactions, receipts, coins and clearsopen
POST /api/txSend a signed transactionopen

AI agents

The repository ships an MCP server. Point Claude, ChatGPT or any MCP client at it and the agent gets seventeen tools: blocks, receipts, coins, clears and perps markets to read, plus transactions to send under its own key. One config block:

{
  "mcpServers": {
    "leyora": {
      "command": "node",
      "args": ["/path/to/leyora/mcp/dist/cli.js"],
      "env": { "LEYORA_API": "https://leyora.xyz", "LEYORA_AGENT_KEY": "<agent key>" }
    }
  }
}

Private data

Routes under /api/me answer only the account they belong to. Prove it with three headers carrying a signed timestamp. A session key is allowed to sign them, which is why a wallet signs once a day rather than every five minutes.

x-l2-pubkey: <the account, a lowercase 0x address>
x-l2-ts:     <unix seconds>
x-l2-sig:    <personal_sign by the account of "LEYORA auth v1\n" + address + "\n" + ts, as 0x hex,
              or the base58 ed25519 signature of the same text by an active session key>

Send a transaction

The message is five fields, chainId, from, nonce, type and body, serialized with sorted keys and no whitespace, and hashed with SHA256. Everything signs the same bytes: the string "LEYORA tx v1", a newline and the canonical JSON. A wallet signs them with personal_sign and the chain recovers its address. Session keys sign them with ed25519. The SDK builds either one.

import { LeyoraClient, SessionKey, buildTx, signEvmEnvelope, signMessageEnvelope } from "@leyora/sdk";

const client = new LeyoraClient({ baseUrl: "https://leyora.xyz" });
const chain = await client.chain();
// Any EVM wallet (viem, Privy, MetaMask). Leyora accounts are lowercase.
const from = walletClient.account.address.toLowerCase();
const wallet = {
  address: from,
  signMessage: (bytes) => walletClient.signMessage({ message: { raw: bytes } }),
};

// 1. One wallet signature opens a session: a browser key with a spend cap.
const session = SessionKey.generate();
const grant = buildTx(chain.chainId, from, await client.nonce(from), "session.grant", {
  sessionKey: session.publicKey,
  expiresAt: Math.floor(Date.now() / 1000) + 3600,
  maxSpend: "5000000000",
  allowedTypes: ["coin.buy", "coin.sell", "pay.transfer"],
});
await client.submit(await signEvmEnvelope(grant, wallet));

// 2. Everything after that is signed by the session key, no prompt.
const buy = buildTx(chain.chainId, from, await client.nonce(from), "coin.buy", {
  coinId, solIn: "500000000", minTokensOut: "1",
});
const { hash } = await client.submit(await signMessageEnvelope(buy, session.signer));

// 3. Private reads are signed by the session key too.
const me = client.me(from, session.signer);
console.log(await me.balances(), hash);
// An agent or a script signs with its own EVM key and never needs a browser wallet.
import { LeyoraClient, buildTx, evmKeySigner, signEvmEnvelope } from "@leyora/sdk";
const agent = evmKeySigner(process.env.AGENT_PRIVATE_KEY); // 0x hex secp256k1 key
const client = new LeyoraClient({ baseUrl: "https://leyora.xyz" });
const tx = buildTx("leyora-hype-1", agent.address, await client.nonce(agent.address), "pay.transfer", {
  to: "0x...", amount: "100000000", // 0.1 HYPE in nano HYPE
});
await client.submit(await signEvmEnvelope(tx, agent));

Transaction types

typebody
pay.transfer{ to, amount }
pay.link.create{ amount, memo?, expiresAt? }
pay.link.claim{ linkId, secret }
pay.link.cancel{ linkId }
coin.launch{ name, symbol, publicGraduation, uri?, initialBuy? }
coin.buy{ coinId, solIn, minTokensOut }
coin.sell{ coinId, tokensIn, minSolOut }
coin.graduate.claim{ coinId, to }
bridge.withdraw{ asset, amount, to, public? }
session.grant{ sessionKey, expiresAt, maxSpend, allowedTypes }
session.revoke{ sessionKey }
perps.open{ market, side, collateral, leverage }
perps.close{ positionId }
perps.lp.deposit{ amount }
perps.lp.withdraw{ shares }

Four types are produced by the sequencer itself and carry no user signature: bridge.deposit, bridge.refund, perps.price and chain.quiet.

Private endpoints

GET /api/me/balancesHYPE and every coin you hold
GET /api/me/historyYour own transactions with amounts and effects
GET /api/me/pointsYour points
GET /api/me/linksYour pay links with their secrets
GET /api/me/withdrawalsYour withdrawals and their status
GET /api/me/claimsGraduated coins ready to claim, and your claims
GET /api/me/sessionsYour session keys
GET /api/me/perps/positionsYour perps positions, open and closed
GET /api/me/perps/lpYour vault shares and their value
GET /api/links/:idA pay link's amount and status, with the x-l2-link-secret header

Deposits

Getting HYPE in is a call to depositFor(account) on the door contract on Elysium, from the app or from any EVM wallet, and the credit shows up once the deposit is confirmed. Plain transfers to the contract are refused. From that point every action, a payment, a trade, a launch, a perps position or a withdrawal, is a Leyora transaction that your code can build and send itself.

Verify

The verifier in the repository walks every block, checks hashes, roots and the producer signature, rebuilds the checkpoint chain and compares it with the events the settlement contract logged on Elysium. Every block page in the explorer does the header check in your browser.

Limits

The API allows 300 requests a minute per address and 60 submitted transactions a minute. A block holds at most 500 transactions.