skr-resolver
v0.0.0
Published
TypeScript library for Solana development using [`@solana/kit`](https://github.com/anza-xyz/kit).
Downloads
132
Readme
skr-resolver
TypeScript library for Solana development using @solana/kit.
Features
- Bun, TypeScript, Biome, tsdown, Changesets, GitHub Actions — batteries included
@solana/kitclient —createClient().use(rpc(...))plugin pattern- Explorer URL helper — generate Solana Explorer links
- WebSocket URL derivation — automatic
wss://fromhttps://RPC URLs - E2E tests — real Solana RPC tests via Surfpool + Testcontainers
Installation
bun installIf you want to override the default RPC endpoint locally, copy the example env file first:
cp .env.example .envUsage
import { createSolanaClient, getExplorerUrl } from 'skr-resolver'
const client = createSolanaClient({ url: 'https://api.devnet.solana.com' })
const slot = await client.rpc.getSlot().send()
console.log(`Current slot: ${slot}`)
const url = getExplorerUrl('tx/your-signature', 'devnet')CLI
# Check connectivity (defaults to devnet)
bun run src/cli.ts
# Custom RPC URL via argument
bun run src/cli.ts https://api.mainnet-beta.solana.com
# Or via environment variable
SOLANA_ENDPOINT=https://api.mainnet-beta.solana.com bun run src/cli.tsDevelopment
bun install
bun run ruler:apply # apply AI agent rules
bun run build
bun run check-types
bun run lint
bun test # unit tests
bun run test:e2e # e2e tests (requires Docker)Testing
Unit tests (bun test) run without any external dependencies.
E2E tests (bun run test:e2e) spin up a Surfpool container via @beeman/testcontainers and run real RPC calls against it. Docker must be running.
Using solana-test-validator instead of Surfpool
To switch the e2e tests to use solana-test-validator, update test/e2e.test.ts:
- import { createLocalSolanaClient, SurfpoolContainer, type StartedSurfpoolContainer } from '@beeman/testcontainers'
+ import { createLocalSolanaClient, SolanaTestValidatorContainer, type StartedSolanaTestValidatorContainer } from '@beeman/testcontainers'
- let container: StartedSurfpoolContainer
+ let container: StartedSolanaTestValidatorContainer
- container = await new SurfpoolContainer().start()
+ container = await new SolanaTestValidatorContainer().start()The client API is identical — both containers expose .url, .urlWs, and work with createLocalSolanaClient().
License
MIT – see LICENSE.
