Skip to main content

Overview

The SaucerSwap Widget is a plug-and-play token swap interface that allows any website or dApp on Hedera Hashgraph to execute instant token swaps. Powered by SaucerSwap’s Smart Order Router (SOR), Universal Router, and Sodax Intent Routing, the widget automatically finds the best execution price across SaucerSwap V1, SaucerSwap V2, and tokenized US equities and ETFs.

Key Benefits

  • Zero Maintenance Liquidity: Direct access to SaucerSwap trading pairs and liquidity pools on Hedera Mainnet.
  • Tokenized Stocks & ETFs: Natively supports trading tokenized US equities (e.g. TSLA, NVDA, AAPL, SPY) via Sodax integration.
  • Custom Integrator Fees: Earn 80% of custom integrator fees configured directly on your widget.
  • Automated Hedera UX: Handles token associations (HTS), Permit2 token approvals, slippage protection, and route splitting automatically.
  • Coexists Seamlessly With Host Wallets: Use the widget’s built-in wallet modal or share your dApp’s existing wallet connection without library collisions.
  • Universal Framework Support: Available as a native React Component, an encapsulated Custom Web Component (<saucerswap-widget>), and a vanilla Script Embed.
👉 Try the Live Configurator Studio: widget.saucerswap.finance

Quickstart

1. React (@saucerswaplabs/widget)

Install the packages via your preferred package manager:
Import and embed <SaucerSwapWidget />:

2. HTML Web Component (<saucerswap-widget>)

Embed inside any HTML framework (Vue, Angular, Svelte, Webflow, Shopify, or static HTML):

Configuration Reference

All properties can be configured via React props or HTML kebab-case attributes on the <saucerswap-widget> custom element:

Integrator Fee

Integrators can optionally add custom fees to swaps executed through the widget:
  • Configuration: Set bps (or integrator-fee-bps) up to a maximum of 500 (5.00%), and set recipient (or integrator-fee-recipient) to your Hedera account ID (e.g. 0.0.123456).
  • Fee Split: Integrators keep 80% of the custom fee, and 20% is retained by SaucerSwap.
  • Execution: Fees are collected automatically on-chain via the Universal Router on the output token. There are zero chargebacks and no payment processing delays.

Wallet Integration & Host Coexistence

The widget supports two wallet modes:

Mode A: Standalone Out-of-the-Box

If your site does not have a wallet connection modal, the widget provides a complete built-in wallet menu:
  • HashPack: Connects via browser extension or mobile pairing.
  • MetaMask: Connects directly via Hedera JSON-RPC EVM provider.
  • Kabila: Connects via Kabila browser extension.
  • WalletConnect: Displays a built-in QR code and copyable pairing code for mobile Hedera wallets.

Mode B: Coexisting with Host dApps (Reown AppKit)

If your dApp already connects to wallets using Reown AppKit or another wallet provider, you can prevent modal duplicates:
  1. Option 1: Pass your connected wallet adapter directly
  2. Option 2: Intercept WalletConnect to trigger your host modal When the user clicks “WalletConnect” inside the widget, the widget emits an event. If you call preventDefault(), the widget modal closes and yields to your host modal:

Customizing Design & Themes

The widget uses CSS custom properties that you can override to match your brand:
In React, you can also pass a style object directly:

Event Hooks & Types

Swap Success Payload (SwapSuccessDetails)


Frequently Asked Questions

Q: Can I add custom integrator fees?

Yes. You can configure custom integrator fees up to 500 bps (5.00%). Integrators keep 80% of the configured fee, and 20% is retained by SaucerSwap.

Q: How does the widget handle Hedera token associations?

The widget inspects the connected account’s token relationships via Hedera Mirror Nodes prior to trade execution. If the user is not associated with the output token, the widget automatically bundles an association step before executing the swap.

Q: Can I lock the tokens to only allow buying my project’s token?

Yes! Set initialOutputToken="0.0.YOUR_TOKEN_ID" and fixedOutput={true}. The buy token selector will be locked so users can only swap into your token.

Q: Where do I get a WalletConnect Project ID?

Create a free project at cloud.reown.com. It takes less than 1 minute and provides the relay infrastructure for wallet pairings.