Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sigil-10dddbf2.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Requirements

  • Node.js 18+ or Bun
  • A Solana wallet (keypair) with SOL on devnet for account rent
  • A Solana RPC endpoint (Helius, QuickNode, or the public devnet URL)

Install the SDK

npm install @sigil-xyz/sdk @coral-xyz/anchor @solana/web3.js bn.js
@sigil-xyz/sdk has peer dependencies on @coral-xyz/anchor and @solana/web3.js — install them explicitly alongside the SDK.

Install the x402 middleware

If you are building a service that gates API endpoints by Sigil credentials:
npm install @sigil-xyz/x402
The package exposes two subpaths:
ImportUse for
@sigil-xyz/x402Express middleware + agent header builder
@sigil-xyz/x402/nextNext.js App Router wrapper

Set up a connection

import { Connection } from '@solana/web3.js'

const connection = new Connection('https://api.devnet.solana.com', 'confirmed')
Use a dedicated RPC URL from Helius or QuickNode in production. The public devnet endpoint is rate-limited.

Construct a SigilClient

SigilClient takes a Connection and a wallet that can sign transactions.
import { SigilClient } from '@sigil-xyz/sdk'
import { Connection, Keypair } from '@solana/web3.js'
import { readFileSync } from 'fs'

const connection = new Connection('https://api.devnet.solana.com', 'confirmed')

// Load your principal keypair
const secret = JSON.parse(readFileSync('/path/to/keypair.json', 'utf-8'))
const keypair = Keypair.fromSecretKey(Uint8Array.from(secret))

const client = new SigilClient({
  connection,
  wallet: {
    publicKey: keypair.publicKey,
    signTransaction: async (tx) => { tx.sign(keypair); return tx },
    signAllTransactions: async (txs) => { txs.forEach(tx => tx.sign(keypair)); return txs },
  },
})
The wallet field accepts any object with publicKey, signTransaction, and signAllTransactions — this matches the AnchorProvider["wallet"] interface. In a browser, pass a wallet adapter directly.