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

@0xtrails/adapter-wagmi

v0.20.0

Published

Use Trails with wagmi

Readme

@0xtrails/adapter-wagmi

Use Trails with wagmi.

This adapter lets Trails use the wagmi setup your app already has. Use it when your app owns WagmiProvider, chains, transports, and connectors, and you want the Trails widget or hooks to share that wallet state. The primary integration target is wagmi 3, with wagmi 2 kept as a compatibility target.

The adapter auto-detects a surrounding WagmiProvider by default:

  • surrounding WagmiProvider and no wagmiConfig option → bridge into the host-owned wagmi runtime
  • same wagmiConfig instance as the surrounding WagmiProvider → bridge into the host-owned wagmi runtime
  • no matching surrounding WagmiProvider and a wagmiConfig option → mount an adapter-owned wagmi runtime with the provided config

For a truly separate Trails-owned runtime, create and pass a separate wagmi config instance.

Install

npm install 0xtrails @0xtrails/adapter-wagmi wagmi viem @tanstack/react-query

Supported wagmi versions:

  • Primary: wagmi@^3.2.0
  • Compatibility: wagmi@^2.19.0

The package peer range remains wagmi@^2.19.0 || ^3.2.0 so existing wagmi 2 hosts can keep using the same adapter.

Quick start: widget with your wagmi provider

import { TrailsWidget } from '0xtrails'
import { wagmiAdapter } from '@0xtrails/adapter-wagmi'
import { WagmiProvider } from 'wagmi'

const apiKey = 'YOUR_TRAILS_API_KEY'

// Automatically uses the surrounding WagmiProvider.
const adapters = [wagmiAdapter()]

export function App() {
  return (
    <WagmiProvider config={wagmiConfig}>
      <TrailsWidget apiKey={apiKey} adapters={adapters} renderInline />
    </WagmiProvider>
  )
}

You only need to pass wagmiConfig when Trails should be able to mount an adapter-owned wagmi runtime fallback.

App-level setup with TrailsProvider

Use this when Trails hooks and the widget should share the same adapter.

import { TrailsProvider, TrailsWidget } from '0xtrails'
import { wagmiAdapter } from '@0xtrails/adapter-wagmi'
import { WagmiProvider } from 'wagmi'

const apiKey = 'YOUR_TRAILS_API_KEY'
const adapters = [wagmiAdapter()]

export function App() {
  return (
    <WagmiProvider config={wagmiConfig}>
      <TrailsProvider config={{ trailsApiKey: apiKey, adapters }}>
        <TrailsWidget renderInline />
      </TrailsProvider>
    </WagmiProvider>
  )
}

Runtime ownership

managedBy is only needed when you pass multiple adapters as wrapped entries. It controls wallet lifecycle ownership in Trails, not whether the wagmi adapter bridges to a parent provider.

const hostAdapter = wagmiAdapter({ wagmiConfig: hostWagmiConfig })
const trailsAdapter = wagmiAdapter({ wagmiConfig: trailsWagmiConfig })

const adapters = [
  { adapter: hostAdapter, managedBy: 'host' },
  { adapter: trailsAdapter, managedBy: 'trails' },
]

Use managedBy: 'host' when Trails can use the wallet but should not own its lifecycle, for example hiding disconnect actions for a host-controlled wallet. Use managedBy: 'trails' for wallet options that Trails should own.

Optional: custom wallet labels

Pass wallets if you want to control how a host wallet appears in Trails. name and icon replace the catalog's label and logo everywhere Trails shows the wallet: the connect list, the connected chip, the funding selector and the recipient rows.

const adapters = [
  wagmiAdapter({
    wagmiConfig,
    wallets: [
      {
        id: 'host-wallet',
        name: 'My Wallet',
        icon: 'https://my.app/wallet.png',
        flow: 'direct',
        placement: 'featured',
      },
    ],
  }),
]

Branding an embedded wallet as your own

Embedded wallets (Privy, Sequence) are host-login identities, so Trails never lists them on its own; a host opts one in with a featured descriptor. The same descriptor is where you rename it. Users of an app built on Privy should see the app's wallet, not Privy's:

wagmiAdapter({
  wagmiConfig: privyWagmiConfig,
  wallets: [
    {
      id: 'privy',
      name: 'XYZ Wallet',
      icon: 'https://xyz.app/wallet.png',
      flow: 'embedded',
      placement: 'featured',
      connect: connectPrivyEmbedded,
    },
  ],
})

Trails resolves any @privy-io/wagmi connector to the id privy, so the descriptor matches the connection whether the user connected through Trails or was already signed in. Privy's own login modal and its "Protected by Privy" footer are configured in the Privy dashboard, outside Trails.

Tips

  • Put adapters on TrailsProvider config.adapters for app-level setup.
  • Put adapters on TrailsWidget adapters for widget-only setup.
  • Do not pass adapters in both places at the same time.
  • Use wagmiAdapter() when Trails should auto-detect and share your existing wagmi runtime.
  • Pass the same wagmiConfig instance when Trails should share that runtime but still have an adapter-owned fallback.
  • Use a separate wagmiConfig instance when Trails should mount a separate adapter-owned runtime.
  • managedBy controls lifecycle ownership in composite adapter lists; it does not override wagmi runtime matching.

License

Apache-2.0