npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chriswilder/fhevm-sdk

v0.1.1

Published

Universal FHEVM SDK - Framework-agnostic frontend toolkit for confidential dApps

Readme

🔧 Universal FHEVM SDK

npm version npm downloads

A framework-agnostic frontend toolkit that helps developers run confidential dApps with ease. Built for the Zama Bounty Program - Universal FHEVM SDK Challenge.

📦 Install: pnpm add @chriswilder/fhevm-sdk | 🔗 npm: @chriswilder/fhevm-sdk

🚀 Quick Start

# Install the SDK
pnpm add @chriswilder/fhevm-sdk

# Import in your project
import { useWallet, useFhevm, useContract, useDecrypt, useEncrypt } from '@chriswilder/fhevm-sdk'

Features

  • Framework-agnostic - Works in React, Next.js, Vue, Node.js
  • Real FHEVM functionality - EIP-712 decryption, encryption, contract interactions
  • Wagmi-like API - Intuitive for web3 developers
  • TypeScript support - Full type safety
  • Clean architecture - Modular and extensible

🏗️ Architecture

fhevm-sdk/
├── src/
│   ├── core/                    # Framework-agnostic core
│   │   ├── fhevm.ts            # FHEVM initialization, encryption & decryption
│   │   ├── contracts.ts        # Contract interactions
│   │   └── index.ts            # Core exports
│   ├── adapters/               # Framework-specific adapters
│   │   ├── react.ts            # React hooks (useWallet, useFhevm, etc.)
│   │   ├── vue.ts              # Vue composables
│   │   ├── node.ts             # Node.js adapter (FhevmNode)
│   │   ├── useWallet.ts        # Wallet connection hook
│   │   ├── useFhevm.ts         # FHEVM instance hook
│   │   ├── useContract.ts      # Contract interaction hook
│   │   ├── useEncrypt.ts       # Encryption hook
│   │   └── useDecrypt.ts       # Decryption hook
│   ├── types/                  # TypeScript type definitions
│   └── index.ts                # Main exports
└── dist/                       # Built files (published to npm)

🔧 Core API

FHEVM Initialization

import { initializeFheInstance } from '@chriswilder/fhevm-sdk'

const fheInstance = await initializeFheInstance()

Encryption

import { createEncryptedInput, encryptValue } from '@chriswilder/fhevm-sdk'

// Create encrypted input for contract calls
const encrypted = await createEncryptedInput(contractAddress, userAddress, value)

// Or use encryptValue directly
const encryptedBytes = await encryptValue(contractAddress, userAddress, value)

Decryption

import { decryptValue, publicDecrypt } from '@chriswilder/fhevm-sdk'

// EIP-712 user decryption (requires user signature)
const decrypted = await decryptValue(encryptedBytes, contractAddress, signer)

// Public decryption (no signature required)
const publicDecrypted = await publicDecrypt(encryptedBytes)

🎯 Framework Adapters

React Hooks (Wagmi-like API)

import { useWallet, useFhevm, useContract, useEncrypt, useDecrypt } from '@chriswilder/fhevm-sdk'

function MyComponent() {
  // Wallet connection
  const { address, isConnected, connect, disconnect } = useWallet()
  
  // FHEVM instance
  const { fheInstance, isInitialized, initialize, error } = useFhevm()
  
  // Contract interactions
  const { contract, isReady, error: contractError } = useContract(contractAddress, abi)
  
  // Encryption hook
  const { encrypt, isEncrypting } = useEncrypt()
  
  // Decryption hook
  const { decrypt, isDecrypting } = useDecrypt()
  
  // Use the hooks...
}

Vue Composables

import { useWalletVue, useFhevmVue, useContractVue, useEncryptVue, useDecryptVue, useFhevmOperationsVue } from '@chriswilder/fhevm-sdk'

export default {
  setup() {
    // Wallet connection
    const { address, isConnected, connect, disconnect } = useWalletVue()
    
    // FHEVM instance
    const { fheInstance, isInitialized, initialize, error } = useFhevmVue()
    
    // Contract interactions
    const { contract, isReady, error: contractError } = useContractVue(contractAddress, abi)
    
    // Encryption composable
    const { encrypt } = useEncryptVue()
    
    // Decryption composable
    const { decrypt } = useDecryptVue()
    
    // FHEVM operations (convenience composable)
    const { executeTransaction, isBusy, message } = useFhevmOperationsVue()
    
    return { address, isConnected, connect, disconnect, fheInstance, isInitialized, initialize }
  }
}

Node.js Adapter

import { FhevmNode } from '@chriswilder/fhevm-sdk'

const fhevm = new FhevmNode()
await fhevm.initialize()

// Use FHEVM operations
const encrypted = await fhevm.encrypt(contractAddress, userAddress, value)
const decrypted = await fhevm.decrypt(encryptedBytes, contractAddress, signer)

Core Functions (Framework-agnostic)

import { 
  initializeFheInstance,
  createEncryptedInput,
  encryptValue,
  decryptValue,
  publicDecrypt,
  FhevmContract
} from '@chriswilder/fhevm-sdk'

// Initialize FHEVM
const fheInstance = await initializeFheInstance({ rpcUrl: 'https://...' })

// Encrypt a value
const encrypted = await createEncryptedInput(contractAddress, userAddress, 42)

// Decrypt a value (requires user signature)
const decrypted = await decryptValue(encryptedBytes, contractAddress, signer)

// Public decryption (no signature)
const publicValue = await publicDecrypt(encryptedBytes)

// Contract interactions
const contract = new FhevmContract(contractAddress, abi, signer)

🔐 FHEVM Features

EIP-712 User Decryption

  • Authentication - User signs decryption requests
  • Security - Only authorized users can decrypt
  • Privacy - Encrypted data remains private

Public Decryption

  • Public data - Anyone can decrypt
  • Leaderboards - Public scores and rankings
  • Transparency - Open data access

Encryption

  • Input encryption - Encrypt values for contract interactions
  • Privacy - Keep data confidential
  • Security - Cryptographic protection

🛠️ Development

Build SDK

pnpm build

Test SDK

pnpm test

Lint SDK

pnpm lint

📦 Dependencies

  • @zama-fhe/relayer-sdk - FHEVM SDK from Zama (v0.3.0-5)
  • @fhevm/solidity - FHEVM Solidity library (v0.9.1)
  • ethers - Ethereum interactions
  • typescript - Type safety

🔄 FHEVM 0.9.1 Compatibility

This SDK is fully compatible with FHEVM 0.9.1 and includes:

  • ZamaEthereumConfig - Updated config for Ethereum networks
  • checkSignatures - Updated signature verification API
  • Self-relaying decryption - Event-driven decryption pattern
  • Public decryption - Support for publicly decryptable handles

🔧 Configuration

TypeScript

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "node"
  }
}

Package.json

{
  "exports": {
    ".": {
      "types": "./src/index.ts",
      "default": "./dist/index.js"
    }
  }
}

🎉 Success Metrics

  • Framework-agnostic - Works in any JavaScript environment
  • Real FHEVM functionality - EIP-712 decryption, encryption, contract interactions
  • Wagmi-like API - Intuitive for web3 developers
  • TypeScript support - Full type safety
  • Clean architecture - Modular and extensible

🏆 Bounty Requirements Met

  • Universal SDK - Framework-agnostic core
  • Real FHEVM functionality - EIP-712 decryption, encryption, contract interactions
  • Wagmi-like API - Hooks/composables for each framework
  • Multiple environments - React, Next.js, Vue, Node.js
  • Clean, reusable - Modular SDK structure
  • Complete documentation - Clear examples and READMEs

Ready for production use! 🚀