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

@dinovox/mx-swap-widget

v0.1.7

Published

DinoVox swap & liquidity widget for MultiversX dApps

Downloads

500

Readme

@dinovox/mx-swap-widget

Plug-and-play swap & liquidity widget for MultiversX dApps, built by DinoVox.

  • Token swap with multi-hop routing across DinoVox and XExchange pools
  • Arbitrage detection (same-token circular swap)
  • EGLD ↔ WEGLD wrap / unwrap
  • Liquidity management: add, remove, create pools, browse pools
  • Bidirectional amount input (type what you want to receive, get the required input)
  • Internal SPA routing via URL anchors — no page reloads, no host router dependency
  • Built-in translations (English & French), works without react-i18next in the host app

Installation

# npm
npm install @dinovox/mx-swap-widget

# from GitHub
npm install github:Dinovox/mx-swap-widget

Import the stylesheet once in your app entry:

import '@dinovox/mx-swap-widget/styles.css';

Quick start

import { SwapWidget } from '@dinovox/mx-swap-widget';
import '@dinovox/mx-swap-widget/styles.css';

export const SwapPage = () => (
  <SwapWidget />
);

No configuration required. The widget connects to the DinoVox DEX API and handles all views (Swap, Liquidity, Pools…) internally.


Configuration

Wrap with SwapConfigProvider to override any default:

import { SwapWidget, SwapConfigProvider } from '@dinovox/mx-swap-widget';

export const SwapPage = () => (
  <SwapConfigProvider config={{
    language: 'fr',
    onConnect: () => navigate('/unlock'),
  }}>
    <SwapWidget />
  </SwapConfigProvider>
);

SwapConfig reference

| Prop | Type | Default | Description | |---|---|---|---| | apiUrl | string | DinoVox mainnet API | Base URL of the DEX API | | routerAddress | string | DinoVox router | Router smart contract address | | aggregatorAddress | string | DinoVox aggregator | Aggregator smart contract address | | factoryAddress | string | DinoVox factory | Factory smart contract address | | wrapContract | string | DinoVox wrap contract | EGLD ↔ WEGLD wrap contract address | | wegldIdentifier | string | WEGLD-bd4d79 | WEGLD token identifier | | onConnect | () => void | — | Called when the user clicks "Connect wallet" while unauthenticated. Pass your app's unlock handler. When omitted the button is disabled. | | language | string | navigator.language | Language code ('en', 'fr') | | theme | 'light' \| 'dark' \| 'mid' | (inherit) | Pin the widget theme independently of the host app. When omitted the widget follows the host app's dark class on <html>. |


Navigation

The widget manages its own view switching via URL hash fragments — no host router required, no page reloads.

| View | Hash | |---|---| | Swap | #swap (or no hash) | | Liquidity | #liquidity | | Add Liquidity | #add-liquidity | | Remove Liquidity | #remove-liquidity | | Create Pool | #create-pool | | Pools | #pools |

The browser's back/forward buttons work out of the box.

Deep-linking

Navigate directly to any view by setting the hash in the URL:

/your-page#add-liquidity?tokenA=EGLD&tokenB=WEGLD-bd4d79

Programmatic navigation

Use the exported useSwapView hook to read the current view or navigate from outside the widget:

import { useSwapView } from '@dinovox/mx-swap-widget';

const { view, goTo } = useSwapView();

goTo('add-liquidity', { tokenA: 'EGLD', tokenB: 'WEGLD-bd4d79' });

SwapWidget props

Beyond SwapConfigProvider, SwapWidget accepts a set of props that override the config for token pre-selection and filtering.

Default tokens

Pre-select tokens in the Swap view. These are used as fallback when no from / to URL param is present.

<SwapWidget
  defaultFrom="EGLD"
  defaultTo="USDC-c76f1f"
/>

URL params always take precedence over these defaults:

/your-page?from=WEGLD-bd4d79   ← this wins over defaultFrom

Token whitelist / blacklist

Control which tokens appear in the selector.

<SwapWidget
  whitelist={['EGLD', 'WEGLD-bd4d79', 'USDC-c76f1f']}
/>
<SwapWidget
  blacklist={['SPAM-123456', 'SCAM-abcdef']}
/>

Both can be combined. Whitelist is applied first, blacklist is applied after.

| Prop | Type | Behaviour when omitted | |---|---|---| | defaultFrom | string | No token pre-selected | | defaultTo | string | No token pre-selected | | whitelist | string[] | All tokens shown | | blacklist | string[] | No token hidden |


Token pre-selection via URL

Pass from and to query params to pre-select tokens in the Swap view:

/your-page?from=EGLD&to=WEGLD-bd4d79

These params are also written to the URL when the user picks a token, enabling shareable links.


Standalone components

Individual views are also exported if you manage rendering yourself:

import {
  Swap,
  Liquidity,
  AddLiquidity,
  RemoveLiquidity,
  CreatePool,
  Pools,
} from '@dinovox/mx-swap-widget';

When using standalone components, wrap them with SwapConfigProvider. The SwapWidget wrapper handles i18n internally; standalone components require a react-i18next instance via initReactI18next in the host app.


Peer dependencies

{
  "@multiversx/sdk-core": ">=15",
  "@multiversx/sdk-dapp": ">=5",
  "axios": ">=1",
  "bignumber.js": ">=9",
  "lucide-react": ">=0.400",
  "react": ">=18",
  "react-dom": ">=18",
  "react-i18next": ">=15"
}

Exported API

| Export | Description | |---|---| | SwapWidget | All-in-one widget with internal routing | | SwapConfigProvider | Configuration context provider | | useSwapConfig | Hook to read the resolved config | | useSwapView | Hook to read the current view and navigate (goTo) | | FormatAmount | Token amount formatter component | | signAndSendTransactions | Helper to sign & send MultiversX transactions | | bigToHex | BigInt → hex string helper | | useGetUserESDT | Hook to fetch user ESDT token balances | | Card | Card UI primitive | | TokenSelect | Token selector dropdown UI primitive |


License

MIT — DinoVox