Winks SDK (rootstock)

A React/Next.js SDK for building on Rootstock with wallet integration, token/NFT utilities, signature management, and RPC Management

Features

  • 🚀 Easy Integration: drop-in Winks wrapper for Next.js

  • 🔑 API-keyed metadata management (server included)

  • 📱 Social meta: Open Graph, Twitter Cards

  • 🎯 Full SEO meta coverage

  • 💰 Token utilities: ERC-20 transfer/approve/balance/allowance

  • 🎨 NFT utilities: ERC-721 owner, ERC-721/1155 transfers, ERC-1155 balance

  • 🔗 Rootstock ready (Testnet 31) — SDK defaults to Testnet in the example app

  • 🌐 Wallet integration via RainbowKit + WalletConnect (styles auto-injected)

  • ✍️ Signature management (tx/message/personal/typed data)

  • 🔄 Network switching helpers

  • 🧭 RPC Management with health checks and latency-based selection

  • 🧩 EIP-1193 Provider adapter

  • 🧯 Signature queueing to avoid overlapping prompts

  • 🛠️ Dual builds (Rollup + Vite) outputting CJS + ESM

  • ✅ Testing setup (Jest unit, Playwright E2E)

Installation

Quick Start (Next.js)

Create an API key:

WalletConnect project ID (RainbowKit)

RainbowKit requires a WalletConnect project ID. Set it in your app (for the example app, create example/.env.local):

Winks Component

Props:

  • apikey: string required

  • children: ReactNode required

  • fallback?: MetaData (used if server fetch fails)

MetaData shape:

Network Configuration

  • Rootstock Mainnet: Chain ID 30, RPC https://public-node.rsk.co, Explorer https://explorer.rootstock.io, Currency RBTC

  • Rootstock Testnet: Chain ID 31, RPC https://public-node.testnet.rsk.co, Explorer https://explorer.testnet.rootstock.io, Currency tRBTC

Server API

  • GET /health

  • POST /api/keys{ id, key, name, createdAt, isActive }

  • GET /api/keys (auth)

  • DELETE /api/keys/:key (auth)

  • GET /api/meta/:apiKey → returns MetaData

  • POST /api/meta/:apiKey (auth) { metadata: MetaData }

  • PUT /api/meta/:apiKey (auth) { metadata: MetaData }

  • DELETE /api/meta/:apiKey (auth)

Auth header: X-API-Key: {apiKey}

Development

Build

Testing

License

MIT

Contributing

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/amazing-feature

  3. Commit your changes: git commit -m 'Add some amazing feature'

  4. Push: git push origin feature/amazing-feature

  5. Open a Pull Request

Last updated