LaserEyes

Backends

Per-network data sources that power on-chain reads.

A backend is a per-network data source — the thing LaserEyes reads balances, UTXOs, fees, and transactions from. Backends come from @lasereyes/client and are supplied per network in your config.

Built-in backends

BackendImportNotes
mempool.space@lasereyes/client/backends/mempoolBase BTC reads, no API key.
Sandshrew@lasereyes/client/backends/sandshrewBroad coverage; takes an apiKey.
Maestro@lasereyes/client/backends/maestroBroad coverage; takes an apiKey.

Each is a factory that resolves against a network:

import { createLaserEyesConfig } from '@omnisat/lasereyes-core'
import { MAINNET, TESTNET } from '@lasereyes/client'
import { mempool } from '@lasereyes/client/backends/mempool'

const config = createLaserEyesConfig({
  chains: [MAINNET, TESTNET],
  connectors: [/* … */],
  backends: {
    mainnet: mempool(),
    testnet: mempool(),
  },
})

Combining backends

Compose a primary with a fallback for one network using combineBackends — the first to satisfy a capability wins:

import { combineBackends } from '@lasereyes/client'
import { sandshrew } from '@lasereyes/client/backends/sandshrew'
import { mempool } from '@lasereyes/client/backends/mempool'

const config = createLaserEyesConfig({
  chains: [MAINNET],
  connectors: [/* … */],
  backends: {
    // sandshrew primary, mempool fallback for base BTC reads
    mainnet: combineBackends(sandshrew({ apiKey: '…' }), mempool()),
  },
})

Custom backends

You can implement your own backend with the primitives in @lasereyes/client/backends (createChainBackend, combineBackends). See Client › Backends for building one.

The native wallet RPC shortcut: when the connected wallet exposes an operation directly (e.g. balance), that path is tried before the backend.

On this page