Stable
secondlayer

Developer infrastructure for Stacks

01/

The Problem

Stacks has no cohesive dev toolkit. Contract calls are untyped string bags. Want to index events? Build your own. Want to query chain state with SQL? Not a thing. You're gluing together 5 different libraries with no shared type system. Hope the types align.
[ terminal ]
 
02/

Stacks Client

@secondlayer/stacks — viem-style typed client for Stacks. Public, wallet, and multisig clients with composable actions. HTTP, WebSocket, and fallback transports. Local and provider accounts. Chain definitions for mainnet, testnet, devnet. Address validation, STX formatting, BNS, PoX, subscriptions.
[ terminal ]
 
03/

Indexer & Views

@secondlayer/indexer consumes Stacks node events. Parses blocks, transactions, contract events. Detects reorganizations, validates parent hashes, auto-backfills gaps. @secondlayer/views lets you define SQL views on indexed chain data. Define a schema, deploy it, query it.
[ terminal ]
 
04/

Contract Codegen

@secondlayer/cli generates type-safe interfaces from Clarity contracts. Point at a local file or deployed contract — network inferred from address prefix. Config-driven with plugins: clarinet(), actions(), react(), testing().
[ terminal ]
 
05/

10 Packages

Everything published under @secondlayer. Use what you need — the stacks client, the indexer, the codegen CLI, or the full stack.
[ terminal ]