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

libertyswap-sdk

v1.2.0

Published

TypeScript SDK for LibertySwap — Bridge USDC between PulseChain and Base

Readme

LibertySwap TypeScript SDK

Universal bridge widget and SDK for bridging USDC from PulseChain to Base

🚀 Features

  • Universal Wallet Support - Works with Privy, Rainbow Kit, WalletConnect, MetaMask, etc.
  • Drop-in React Widget - Beautiful pre-built UI component
  • White-Label Ready - Customize branding, colors, fees
  • Affiliate Tracking - Built-in revenue sharing
  • TypeScript First - Full type safety
  • Production Ready - Battle-tested on mainnet

📦 Installation

npm install ethers @privy-io/react-auth
# or
yarn add ethers @privy-io/react-auth

Copy the SDK files to your project:

  • src/libertySwap.ts
  • src/UniversalBridgeWidget.tsx
  • src/types.ts
  • src/config.ts

🎯 Quick Start

Option 1: Use the Universal Widget (Recommended)

import { UniversalBridgeWidget } from './src/UniversalBridgeWidget';
import { useWallets } from '@privy-io/react-auth';

function App() {
  const { wallets } = useWallets();

  return (
    <UniversalBridgeWidget
      walletProvider={wallets[0]}
      config={{
        brandName: 'My App',
        primaryColor: '#6366f1',
        showBalances: true,
        onBridgeComplete: (result) => {
          console.log('Success!', result.txHash);
        }
      }}
    />
  );
}

Option 2: Use the SDK Directly

import { LibertySwapSDK } from './src/libertySwap';
import { ethers } from 'ethers';

async function bridgeUSDC(signer: ethers.Signer) {
  const sdk = new LibertySwapSDK(signer);

  const result = await sdk.bridgeUSDCToBase(
    '100',                 // Amount in USDC
    '0xRecipientAddress'   // Where it goes on Base
  );

  if (result.success) {
    console.log('Bridged!', result.txHash);
  }
}

🎨 Widget Customization

The widget is fully customizable:

const config = {
  // Branding
  brandName: 'Your Brand',
  brandLogo: '/logo.png',
  primaryColor: '#8b5cf6',
  secondaryColor: '#f3f4f6',
  borderRadius: '16px',

  // Limits
  minAmount: 10,
  maxAmount: 10000,
  defaultAmount: '100',

  // Features
  showBalances: true,
  showFees: true,

  // Destination (optional - if you want USDC to go to your contract)
  destinationAddress: '0xYourContractOnBase',

  // Revenue sharing
  affiliateId: 'partner-123',
  platformFeePercent: 0.1, // 0.1% additional fee

  // Callbacks
  onBridgeComplete: (result) => {
    // Handle success
  },
  onError: (error) => {
    // Handle error
  },
  onStatusChange: (status) => {
    // Track progress
  }
};

💡 Use Cases

1. Simple Bridge Widget

<UniversalBridgeWidget
  walletProvider={wallet}
  config={{ brandName: 'Bridge' }}
/>

2. Bridge to Your Contract

<UniversalBridgeWidget
  walletProvider={wallet}
  config={{
    destinationAddress: '0xYourContractOnBase',
    onBridgeComplete: async (result) => {
      // Wait for USDC to arrive
      await waitForBridge();
      // Call your contract
      await yourContract.doSomething();
    }
  }}
/>

3. White-Label Solution

<UniversalBridgeWidget
  walletProvider={wallet}
  config={{
    brandName: 'Partner Bridge',
    brandLogo: '/partner-logo.png',
    primaryColor: '#your-color',
    affiliateId: 'partner-123',
    platformFeePercent: 0.1
  }}
/>

📖 API Reference

LibertySwapSDK

class LibertySwapSDK {
  constructor(signer: ethers.Signer);

  // Bridge USDC to Base
  bridgeUSDCToBase(amount: string, recipient: string): Promise<BridgeResult>;

  // Bridge all USDC
  bridgeAllUSDC(recipient: string): Promise<BridgeResult>;

  // Get balances
  getUSDCBalance(address: string): Promise<BalanceInfo>;
  getBaseUSDCBalance(address: string): Promise<BalanceInfo>;
  getPLSBalance(address: string): Promise<string>;
  getStatus(address: string): Promise<ChainStatus>;

  // Calculate fees
  calculateExpectedOutput(amount: string): FeeCalculation;

  // Approval management
  needsApproval(amount: string, owner: string): Promise<boolean>;
  approveUSDC(amount: string): Promise<BridgeResult>;
}

UniversalBridgeWidget

interface UniversalBridgeWidgetProps {
  // Wallet provider (flexible)
  signer?: ethers.Signer;
  walletProvider?: any;

  // Configuration
  config?: WidgetConfig;

  // Styling
  className?: string;
  style?: React.CSSProperties;
}

🔧 Wallet Integration Examples

See examples/WidgetIntegrations.tsx for:

  • ✅ Privy integration
  • ✅ Rainbow Kit integration
  • ✅ WalletConnect integration
  • ✅ White-label setup
  • ✅ Affiliate tracking
  • ✅ Contract destination
  • ✅ And more!

💰 Revenue Model

Built-in support for:

  1. Affiliate Fees - Track referrals and earn commissions
  2. Platform Fees - Add your own fee on top of LibertySwap's 0.3%
  3. Custom Destinations - Route USDC to your contracts

Example:

config={{
  affiliateId: 'partner-123',
  platformFeePercent: 0.1,  // Earn 0.1% per bridge
  destinationAddress: '0xYourContract'
}}

🚀 Publishing as NPM Package

  1. Build the package:
npm run build
  1. Publish:
npm publish --access public
  1. Use in any project:
npm install @yourusername/libertyswap-widget

📊 Contract Addresses

All contracts are already deployed:

  • PulseChain Router: 0x0E0eDDaE092176d851d5C70A49b5d83e2510e72f
  • Base Router: 0x1A19B9f2687C390a130a261d1E9f0B34f5ABf312
  • PulseChain USDC: 0x15D38573d2feeb82e7ad5187aB8c1D52810B1f07
  • Base USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

🔐 Security

  • ✅ Non-custodial - users sign transactions themselves
  • ✅ No private keys ever exposed
  • ✅ Contracts are verified and audited
  • ✅ Open source

📞 Support

📄 License

MIT

🌟 Features Roadmap

  • [ ] Multi-token support (PLS, HEX, PLSX)
  • [ ] Batch bridging
  • [ ] Bridge history tracking
  • [ ] Price impact calculations
  • [ ] MEV protection

Ready to integrate! 🚀

Copy the files, customize the widget, and start bridging!