Documentation

Introduction to LaserEyes

A powerful wallet connect library making it easier than ever to build and maintain Bitcoin Ordinal Web Apps.

LaserEyes provides a unified interface to interact with multiple Bitcoin wallets, making it simple to add wallet connectivity to your web applications.

Why LaserEyes?

Building Bitcoin web applications can be challenging due to the variety of wallet providers and their different APIs. LaserEyes solves this problem by providing a unified interface that works with all major Bitcoin wallets.

Key Features

Multi-wallet Support

Seamless integration with UniSat, Xverse, OYL, and more Bitcoin wallets through a unified interface.

Complete Ordinals Support

Full support for Bitcoin Ordinals, inscriptions, and BRC-20 tokens out of the box.

First-class TypeScript

Built with TypeScript from the ground up, providing excellent type safety and developer experience.

Security Focused

Security-first approach with built-in protections and best practices for handling Bitcoin transactions.

Performance Optimized

Optimized for performance with minimal overhead and efficient state management.

DataSource Abstraction

Flexible data source system for seamlessly switching between different Bitcoin data providers.

Installation

npm

npm install @omnisat/lasereyes-core @omnisat/lasereyes-react

Basic Usage

Example

import { LaserEyesProvider } from '@omnisat/lasereyes-react'
import { useLaserEyes } from '@omnisat/lasereyes-react'
import { MAINNET, UNISAT } from '@omnisat/lasereyes-core'

function App() {
  return (
    <LaserEyesProvider
      config={{ network: MAINNET }}
    >
      <WalletConnect />
    </LaserEyesProvider>
  )
}

function WalletConnect() {
  const {
    connect,
    disconnect,
    connected,
    address
  } = useLaserEyes()

  return (
    <div>
      {connected ? (
        <>
          <div>Connected: {address}</div>
          <button onClick={disconnect}>Disconnect</button>
        </>
      ) : (
        <button onClick={() => connect(UNISAT)}>Connect Wallet</button>
      )}
    </div>
  )
}