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

@hypermid/crosschain-widget

v1.0.0

Published

Embeddable cross-chain swap widget for Hypermid — drop into any website with a single script tag or npm import

Readme

@hypermid/crosschain-widget

Embeddable cross-chain swap widget for Hypermid. Drop it into any site with an npm import or a single <script> tag and your users can swap across 90+ chains (EVM + Solana + Bitcoin + Sui + Near Intents) without leaving your page.

The widget mounts the live Hypermid swap app in a sandboxed iframe — so wallet connection, quoting, cross-chain execution, status tracking and partner attribution all come built-in and stay current automatically. Zero runtime dependencies (~2 KB gzipped).

Install

npm install @hypermid/crosschain-widget
import { HypermidWidget } from "@hypermid/crosschain-widget";

const widget = new HypermidWidget({
  containerId: "swap-widget",
  apiKey: "pk_live_…",      // optional — attributes swaps to your account
  theme: "dark",
  defaultFromChain: 8453,   // Base
  defaultToChain: 369,      // PulseChain
});

widget.mount();
// widget.destroy(); // when unmounting (e.g. React useEffect cleanup)

Script tag (no build step)

<div id="hypermid-widget"></div>
<script src="https://unpkg.com/@hypermid/crosschain-widget"></script>
<script>
  HypermidWidget.init({
    containerId: "hypermid-widget",
    apiKey: "pk_live_…",
    theme: "dark",
  });
</script>

Or fully declarative (auto-init):

<div id="hypermid-widget" data-hypermid-widget data-api-key="pk_live_…" data-theme="dark"></div>
<script src="https://unpkg.com/@hypermid/crosschain-widget"></script>

Already using the hosted script? https://hypermid.io/widget/v1/embed.js is the same widget — this package is just the typed, npm-distributed version of it.

Attribution (apiKey)

apiKey is optional. With a key, swaps are attributed to your partner account (fees accrue to you) — the widget sends it as X-API-Key on the underlying calls. Without one, the widget works exactly the same, just as organic/unattributed traffic. Use a publishable key (pk_live_…); it ships in client code by design.

Config

| Option | Type | Default | Description | |---|---|---|---| | containerId | string | required | DOM element id to mount into | | apiKey | string | — | Publishable key for partner attribution (optional) | | theme | "dark" \| "light" | "dark" | Color theme | | mode | "swap" \| "gas" \| "fund" | "swap" | Opening tab (fund = Buy with card) | | defaultFromChain / defaultToChain | number | — | Preset chain IDs | | defaultFromToken / defaultToToken | string | — | Preset token addresses | | defaultFromAmount | string | — | Preset input amount | | lockFromChain / lockToChain | boolean | false | Prevent the user changing a chain | | hideOnramp | boolean | false | Hide the Buy-with-card tab | | hidePoweredBy | boolean | false | Hide the footer (subject to agreement) | | width | string | "420px" | Widget width | | height | string | "640px" | Floor height — the widget grows to fit taller content | | borderRadius | string | "16px" | Outer radius | | accentColor, secondaryColor, errorColor, bgCard, bgInput, textPrimary, … | string | app theme | Hex theming overrides (with or without #) | | fontFamily | string | "Sora" | Google-font family name |

Events

const widget = new HypermidWidget({
  containerId: "swap-widget",
  onReady:        ()        => console.log("widget loaded"),
  onQuote:        (q)       => console.log("quote", q),
  onExecute:      (r)       => console.log("swap submitted", r),
  onStatusChange: (s)       => console.log("status", s),
  onError:        (e)       => console.error("error", e),
});
widget.mount();

Methods

widget.mount();                                   // create + insert the iframe
widget.update({ theme: "light" });                // merge config + reload
widget.setSwap({ fromChain: 8453, toChain: 369 }); // change params without reload
widget.setTheme("light");                          // switch theme without reload
widget.destroy();                                  // remove iframe + listeners

Notes

  • Isolation: the widget is an iframe, so there are no CSS/JS conflicts with your page.
  • Local testing: open your page over http://localhost (e.g. npx serve .), not file:// — browsers block iframes on file://. See https://docs.hypermid.io/widget/overview#testing-locally.
  • Multiple widgets per page are supported; each instance tracks its own iframe.

License

MIT