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

@soulsolidity/zap-widgets

v0.0.1-alpha13

Published

SDK for interacting with the SoulZap protocol

Readme

SoulZap SDK

A React SDK for integrating SoulZap functionality into your applications. This SDK provides a set of UI components and utilities to enable users to zap from one token to another across different chains.

Features

  • DEX-like UI/UX: Interactive swapping interface
  • Token Selection: Dynamically fetch supported tokens from the registry
  • Customizable UI: Style components to match your branding
  • Wallet Integration: Works with any wallet connection library
  • Flexible Integration: Easy-to-use components for React applications
  • TypeScript Support: Full type definitions for all components and utilities

Installation

npm install zap:sdk
# or
yarn add zap:sdk

Quick Start

import { ZapProvider, ZapWidget } from 'zap:sdk';
import { useAccount } from 'wagmi';

function App() {
  // Get wallet address from your preferred wallet library
  const { address } = useAccount();

  // Handle successful zap
  const handleSuccess = (result) => {
    console.log('Zap successful:', result);
  };

  // Handle zap error
  const handleError = (error) => {
      console.error('Zap failed:', error);
  };

  return (
    <ZapProvider defaultUserAddress={address}>
      <ZapWidget 
        onSuccess={handleSuccess}
        onError={handleError}
      />
    </ZapProvider>
  );
}

Components

ZapWidget

The main component that provides a complete UI for zapping tokens.

<ZapWidget 
  className="custom-class"
  theme="light" // 'light', 'dark', or 'auto'
  onSuccess={handleSuccess}
  onError={handleError}
/>

Props

  • className: Custom CSS class for styling
  • theme: UI theme ('light', 'dark', or 'auto')
  • onSuccess: Callback for successful zap
  • onError: Callback for zap errors

ZapProvider

Context provider that manages the state and functionality for the zap components.

<ZapProvider
  defaultChainId={56}
  defaultFromToken="0x0000000000000000000000000000000000000000"
  defaultUserAddress={walletAddress}
>
  {/* Your components */}
</ZapProvider>

Props

  • defaultChainId: Default chain ID to use
  • defaultFromToken: Default token address to use as the source token
  • defaultUserAddress: User's wallet address from your wallet connection library

Individual Components

The SDK also exports individual components for custom integrations:

  • TokenSelector: Component for selecting tokens
  • AmountInput: Input field for token amounts
  • ChainSelector: Component for selecting blockchain networks
  • TransactionPreview: Component for previewing transactions

Wallet Integration

The SDK is designed to work with any wallet connection library. Simply pass the user's wallet address to the ZapProvider component:

// With wagmi/viem
import { useAccount } from 'wagmi';

function App() {
  const { address } = useAccount();
  
  return (
    <ZapProvider defaultUserAddress={address}>
      <ZapWidget />
    </ZapProvider>
  );
}

// With ethers.js
import { useState, useEffect } from 'react';
import { ethers } from 'ethers';

function App() {
  const [address, setAddress] = useState('');
  
  useEffect(() => {
    const connectWallet = async () => {
      if (window.ethereum) {
        const provider = new ethers.providers.Web3Provider(window.ethereum);
        const accounts = await provider.send('eth_requestAccounts', []);
        setAddress(accounts[0]);
      }
    };
    
    connectWallet();
  }, []);
  
  return (
    <ZapProvider defaultUserAddress={address}>
      <ZapWidget />
    </ZapProvider>
  );
}

API

Hooks

  • useZap(): Hook to access the zap context and functionality

Utilities

  • fetchRegistry(): Fetch the zap registry data
  • transformRegistryToTokens(): Transform registry data into a list of tokens
  • getSupportedChains(): Get supported chains from the registry
  • getTokensByChain(): Get tokens for a specific chain
  • makeZapRequest(): Make a zap API call
  • formatAddress(): Format an address to a shortened form
  • formatNumber(): Format a number to a readable string
  • isValidAddress(): Validate if a string is a valid Ethereum address
  • chainIdToName(): Format a chain ID to its network name

API Endpoint

The SDK interacts with the following API endpoint:

GET http://localhost:3001/zap?fromToken=<address>&fromAmount=<amount>&toToken=<address>&chain=<chainId>&user=<walletAddress>

Registry Data

The SDK fetches supported tokens from the registry at: https://raw.githubusercontent.com/SoulSolidity/registry/main/data/constants/zap.json

Customization

Styling

The SDK uses Tailwind CSS for styling. You can customize the appearance by:

  1. Providing custom classes via the className prop
  2. Setting the theme prop to 'light', 'dark', or 'auto'
  3. Overriding the CSS variables in your application

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build the SDK
npm run build:sdk

License

MIT