aniswap
v1.3.0
Published
Embeddable swap widget for Worldchain – configurable tokens, Uniswap quotes, creator & integrator fees, light/dark theme
Maintainers
Readme
AniSwap
Embeddable swap widget for Worldchain: configurable token list, Uniswap V2 quotes, creator fees, light/dark theme. No API keys or fee signatures required.
Install
npm install aniswapPeer dependencies: react, react-dom, ethers ^6, @worldcoin/minikit-js. Your app should use Tailwind CSS (widget uses bg-primary, rounded-lg, etc.).
Quick Start
Set your feeRecipient and creatorFeeBps. Platform fee is 0.25%; your creator fee is configurable (max 5%).
import { AniSwap, getDefaultSwapSdkConfig } from "aniswap";
const config = getDefaultSwapSdkConfig({
feeRecipient: "0x...", // your address for creator fees
creatorFeeBps: 100, // 1% (max 500 = 5%)
theme: "dark",
tokens: [
{ address: "0x...", symbol: "USDC", name: "USD Coin", decimals: 6, imageUrl: "https://..." }, // Example
{ address: "0x...", symbol: "ANI", name: "ANI", decimals: 18, imageUrl: "https://..." }, // Example
],
defaultFromTokenAddress: "0x...",
defaultToTokenAddress: "0x...",
});
<AniSwap
config={config}
walletAddress={userAddress} // the wallet address of the user
onClose={() => setOpen(false)}
onSwapSuccess={(txHash) => console.log(txHash)}
onError={(msg) => console.error(msg)}
/>Whitelist this contract to your WorldApp Developer Portal.
0x3a4BDF016e9B0Aee8f8ebd0747fd10BbC5189F37
Config
| Field | Description |
|-------|-------------|
| feeRecipient | Address that receives creator fees |
| creatorFeeBps | Your fee in basis points (100 = 1%, max 500 = 5%) |
| theme | "light" | "dark" | "system" (default: "dark") |
| tokens | Token list: { address, symbol, name?, decimals?, imageUrl? } |
| defaultFromTokenAddress | Preselected "from" token |
| defaultToTokenAddress | Preselected "to" token |
Token fields: address (required), symbol (required), name (optional), decimals (optional), imageUrl (optional, for token icon).
Theme
Set theme in config: "light" | "dark" | "system". Define Tailwind variables like primary, muted, etc. in your app.
License
MIT
