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

@zerodev/smart-routing-address-react-ui

v0.0.3

Published

React hooks, provider, and UI for ZeroDev Smart Routing Address deposits

Readme

@zerodev/smart-routing-address-react-ui

React UI kit for ZeroDev Smart Routing Address — a drop-in funding widget that generates a single deposit address, routes whatever the user sends across chains and tokens, and reports live status.

Mount one component, get a full deposit-funding experience: token & source chain picker, QR + copy card, live fee breakdown, pending/past deposit lists, and a per-transaction details view. UI styling comes from @zerodev/react-ui.

Installation

pnpm add @zerodev/smart-routing-address-react-ui viem

react (18 or 19), react-dom, and viem are peer dependencies — install them alongside this package. @zerodev/smart-routing-address ships as a regular dependency; install it directly only if you import from it (e.g. createCall for custom actions).

Setup

1. Import the stylesheet once at app entry

import '@zerodev/smart-routing-address-react-ui/styles.css'

2. Wrap the subtree in SmartRoutingAddressProvider

The provider holds the config and lazily creates the smart routing address for a recipient. It doesn't render the widget — mount <SmartRoutingAddress /> inline where you want the UI.

import {
  SmartRoutingAddress,
  SmartRoutingAddressProvider,
} from '@zerodev/smart-routing-address-react-ui'
import { arbitrum } from 'viem/chains'

function Funding({ recipient }: { recipient: `0x${string}` }) {
  return (
    <SmartRoutingAddressProvider
      config={{
        projectId: 'your-project-id', // from https://dashboard.zerodev.app
        targetChainId: arbitrum.id,
        slippage: 100, // max slippage in basis points (100 = 1%)
      }}
    >
      <SmartRoutingAddress recipient={recipient} onClose={() => {}} />
    </SmartRoutingAddressProvider>
  )
}

Usage

<SmartRoutingAddress /> renders the current step (deposit, past deposits, or a single transaction's details) inside its own card frame. Navigation is owned by the widget; onClose fires when the top-right ✕ is tapped so the host app can dismiss.

<SmartRoutingAddress
  recipient={recipient}
  onClose={() => setOpen(false)}
  size="lg" // 'sm' | 'md' | 'lg'
/>

Address creation and deposit polling happen in the provider; host code can observe the widget's state via useSmartRoutingAddress() (e.g. drive a companion panel from the route the widget is showing) and pre-create the address via useCreateSmartRoutingAddress().getOrCreateAddress before the modal opens. To build a fully custom deposit UI, use the @zerodev/smart-routing-address SDK directly — this package's hooks are widget plumbing, not a UI kit.

Configuration

Everything the widget needs is on the config passed to the provider.

| Field | Type | Description | | --- | --- | --- | | projectId | string? | ZeroDev project id; appended to the SRA server URL. | | targetChainId | number | Chain id where funds settle. Required. | | version | SmartRoutingAddressVersion? | SRA manager version. Defaults to the latest stable. | | actions | CreateSmartRoutingAddressParams['actions']? | Destination actions per token type. When omitted, deposits are simply transferred to the recipient. | | slippage | number | Max slippage in basis points (50 = 0.5%). Required. Tight values inflate minDeposit (server computes it as ~fee / slippage). | | baseUrl | string? | Override the SRA server root URL; the projectId is appended. |

API

| Export | Description | | --- | --- | | <SmartRoutingAddressProvider /> | Wraps the subtree; owns config, recipient, and the address lifecycle. | | <SmartRoutingAddress /> | The funding widget UI. Props: recipient, onClose, size?, className?. | | useSmartRoutingAddress() | Read-only widget companion for hosts: address state and the activeRoute the widget is showing. | | useCreateSmartRoutingAddress() | Action counterpart: getOrCreateAddress(recipient) returns the deposit address, creating it if needed — idempotent per recipient, so it's safe to call on every hover/open. Creation params come from the provider config. |

Types

SmartRoutingAddressConfig, SmartRoutingAddressProps, SmartRoutingAddressStep, SmartRoutingAddressProviderProps, UseSmartRoutingAddressResult, UseCreateSmartRoutingAddressResult.

Development

pnpm build       # build the package (dist + types + css)
pnpm dev         # watch mode (types)
pnpm typecheck
pnpm test        # vitest
pnpm storybook   # component catalog