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

@anuragchvn-blip/mandatekit

v1.0.0

Published

Production-ready Web3 autopay SDK for crypto-based recurring payments using EIP-712 mandates

Readme

🚀 MandateKit

Production-ready Web3 autopay SDK for crypto-based recurring payments on Polygon

MandateKit enables developers to easily create and manage recurring payments using EIP-712 mandates, relayer automation, pull-based billing, cadence enforcement, and secure non-custodial payments.

npm version License: MIT

🌟 Live Deployment

Smart Contract Address (Polygon Mainnet):

0xd9145CCE52D386f254917e481eB44e9943F39138

View on PolygonScan

✨ Features

  • 🔐 EIP-712 Typed Signatures - Secure, human-readable mandate signing (no phishing)
  • 🤖 Relayer Automation - Automated pull-based payment execution with fee incentives
  • Cadence Enforcement - Flexible scheduling (daily, weekly, monthly, yearly, custom)
  • 🔄 Replay Protection - Built-in nonce and timestamp validation
  • 🛡️ Security Hardened - Checks-Effects-Interactions pattern, ReentrancyGuard
  • 💰 Non-Custodial - Users always maintain control of their funds
  • 🧩 Modular & Tree-shakeable - Import only what you need
  • 💪 TypeScript First - Full type safety and IntelliSense
  • 🔌 Adapter Support - Permit2, vaults, account abstraction ready
  • 📦 Modern Stack - Built with Viem v2, ES2020+, OpenZeppelin v5

📦 Installation

From GitHub Packages

# Configure npm to use GitHub Packages
echo "@anuragchvn-blip:registry=https://npm.pkg.github.com" >> .npmrc

# Install the package
npm install @anuragchvn-blip/mandatekit viem

From npm (Coming Soon)

npm install @anuragchvn-blip/mandatekit viem

🏃 Quick Start

Backend (Node.js)

import { createMandateClient } from '@anuragchvn-blip/mandatekit/client';
import { privateKeyToAccount } from 'viem/accounts';
import { polygon } from 'viem/chains';

const account = privateKeyToAccount('0x...');
const client = createMandateClient({ 
  account,
  chain: polygon 
});

// Create a mandate for recurring USDC payments
const mandate = await client.signMandate({
  subscriber: '0x123...', // Payer address
  token: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC on Polygon
  amount: '10000000', // 10 USDC (6 decimals)
  cadence: { interval: 'monthly', count: 1 },
  recipient: '0x456...', // Recipient address
  validAfter: Math.floor(Date.now() / 1000),
  validBefore: Math.floor(Date.now() / 1000) + 31536000, // 1 year
  maxPayments: 12, // Optional: auto-cancel after 12 payments
  metadata: 'Netflix subscription', // Optional
});

console.log('Mandate ID:', mandate.mandateId);
console.log('Signature:', mandate.signature);

Frontend (Browser with MetaMask)

import { createMandateClient } from '@anuragchvn-blip/mandatekit/client';
import { createWalletClient, custom } from 'viem';
import { polygon } from 'viem/chains';

const walletClient = createWalletClient({
  chain: polygon,
  transport: custom(window.ethereum),
});

const [address] = await walletClient.getAddresses();
const client = createMandateClient({ 
  walletClient, 
  address 
});

// User signs mandate in MetaMask
const mandate = await client.signMandate({
  subscriber: address,
  token: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC
  amount: '10000000', // 10 USDC
  cadence: { interval: 'monthly', count: 1 },
  recipient: '0x456...',
  validAfter: Math.floor(Date.now() / 1000),
  validBefore: Math.floor(Date.now() / 1000) + 31536000,
});

// Register mandate on-chain
const txHash = await client.registerMandate(mandate);
console.log('Registered:', txHash);

Relayer (Automated Execution)

import { createRelayerClient } from '@anuragchvn-blip/mandatekit/relayer';
import { privateKeyToAccount } from 'viem/accounts';
import { polygon } from 'viem/chains';

const relayerAccount = privateKeyToAccount('0x...');
const relayer = createRelayerClient({
  account: relayerAccount,
  chain: polygon,
  registryAddress: '0xd9145CCE52D386f254917e481eB44e9943F39138',
  pollInterval: 60000, // Check every minute
});

// Schedule mandate for automated execution
await relayer.scheduleMandate(mandate);

// Relayer earns 0.5% fee for executing payments
console.log('Relayer monitoring active mandates...');

📚 Documentation

🎯 Use Cases

  • 💳 Subscription Services - Netflix-style recurring billing in crypto
  • 💼 Payroll - Pay employees/contractors on a schedule
  • 📈 Dollar-Cost Averaging (DCA) - Automated periodic token purchases
  • 🏠 Rent/Bills - Recurring payments for utilities, rent, etc.
  • 🎮 Gaming - Season passes and recurring in-game purchases
  • 📱 SaaS - Decentralized software subscriptions

🏗️ Architecture

MandateKit
├── client/       → Mandate signing & verification (EIP-712)
├── relayer/      → Automated execution engine
├── contracts/    → Smart contract ABIs & addresses
├── utils/        → Cryptographic & validation utilities
└── adapters/     → Protocol integrations (Permit2, vaults, AA)

🔒 Security

Smart Contract Security

  • Checks-Effects-Interactions Pattern - Prevents reentrancy attacks
  • ReentrancyGuard - OpenZeppelin's reentrancy protection
  • SafeERC20 - Secure token transfers with proper error handling
  • Nonce-based Replay Protection - Each mandate uses unique nonce
  • Timestamp Validation - Enforces validAfter/validBefore windows
  • Cadence Enforcement - Contract-level payment scheduling
  • Signature Verification - EIP-712 typed data signatures
  • Owner Access Control - Only owner can modify critical parameters

SDK Security

  • EIP-712 Typed Data - Human-readable signatures prevent phishing
  • Input Validation - Comprehensive validation before signing
  • TypeScript Type Safety - Compile-time error prevention
  • No Private Key Storage - Uses viem's secure account handling

Deployed Contract

Polygon Mainnet: 0xd9145CCE52D386f254917e481eB44e9943F39138

  • Owner: 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4
  • Fee Collector: 0x2913411D27f5d6716590F952b50088779Ae4a699
  • Relayer Fee: 0.5% (50 basis points)
  • Max Fee Cap: 5% (500 basis points)

🛠️ Development

Setup

# Clone repository
git clone https://github.com/anuragchvn-blip/MandateKit.git
cd MandateKit

# Install dependencies
npm install

# Build SDK
npm run build

# Run examples
npm run example:backend
npm run example:relayer

Publishing to GitHub Packages

# Authenticate with GitHub
npm login --registry=https://npm.pkg.github.com

# Build and publish
npm run build
npm publish

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide first.

📄 License

MIT © 2025 MandateKit

🔗 Links

⚠️ Disclaimer

This software is provided "as is", without warranty of any kind. Use at your own risk. Always test thoroughly before using in production with real funds.