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

@t402/wdk-gasless

v2.0.0-beta.1

Published

Gasless USDT0 payments with Tether WDK and ERC-4337 Account Abstraction

Readme

@t402/wdk-gasless

Gasless USDT0 payments with Tether WDK and ERC-4337 Account Abstraction.

Features

  • Gasless Payments: Send USDT0/USDC without paying gas fees
  • ERC-4337 Integration: Uses Safe smart accounts with Account Abstraction
  • Batch Payments: Execute multiple transfers in a single transaction
  • Multi-Chain Support: Ethereum, Arbitrum, Base, Optimism, Ink, Berachain, Unichain
  • Paymaster Sponsorship: Optional gas sponsorship via paymasters

Installation

npm install @t402/wdk-gasless
# or
pnpm add @t402/wdk-gasless

Peer Dependencies

npm install @tetherto/wdk @tetherto/wdk-wallet-evm

Quick Start

import { createWdkGaslessClient } from '@t402/wdk-gasless'
import { createPublicClient, http } from 'viem'
import { arbitrum } from 'viem/chains'

// Create a public client
const publicClient = createPublicClient({
  chain: arbitrum,
  transport: http(),
})

// Create the gasless client
const client = await createWdkGaslessClient({
  wdkAccount: myWdkAccount, // From @tetherto/wdk
  publicClient,
  chainId: 42161, // Arbitrum
  bundler: {
    bundlerUrl: 'https://api.pimlico.io/v2/arbitrum/rpc?apikey=YOUR_KEY',
    chainId: 42161,
  },
  paymaster: {
    address: '0x...',
    url: 'https://api.pimlico.io/v2/arbitrum/rpc?apikey=YOUR_KEY',
    type: 'sponsoring',
  },
})

// Execute a gasless payment
const result = await client.pay({
  to: '0xRecipientAddress...',
  amount: 1000000n, // 1 USDT0 (6 decimals)
})

// Wait for confirmation
const receipt = await result.wait()
console.log('Payment confirmed:', receipt.txHash)

API Reference

createWdkGaslessClient(config)

Creates a new gasless payment client.

interface CreateWdkGaslessClientConfig {
  wdkAccount: WdkAccount // WDK account from @tetherto/wdk
  publicClient: PublicClient // Viem public client
  chainId: number // Chain ID
  bundler: BundlerConfig // Bundler configuration
  paymaster?: PaymasterConfig // Optional paymaster for gas sponsorship
  saltNonce?: bigint // Salt for address generation (default: 0n)
}

WdkGaslessClient

pay(params): Promise<GaslessPaymentResult>

Execute a single gasless payment.

interface GaslessPaymentParams {
  to: Address // Recipient address
  amount: bigint // Amount in token decimals
  token?: 'USDT0' | 'USDC' | Address // Token (default: 'USDT0')
}

interface GaslessPaymentResult {
  userOpHash: Hex // UserOperation hash
  sender: Address // Smart account address
  sponsored: boolean // Whether gas was sponsored
  wait(): Promise<GaslessPaymentReceipt>
}

payBatch(params): Promise<GaslessPaymentResult>

Execute multiple payments in a single transaction.

interface BatchPaymentParams {
  payments: Array<{
    to: Address
    amount: bigint
    token?: 'USDT0' | 'USDC' | Address
  }>
}

canSponsor(params): Promise<SponsorshipInfo>

Check if a payment can be gas-sponsored.

interface SponsorshipInfo {
  canSponsor: boolean
  reason?: string
  estimatedGasCost?: bigint
}

getBalance(token?): Promise<bigint>

Get the token balance of the smart account.

getFormattedBalance(token?, decimals?): Promise<string>

Get the formatted token balance (human-readable).

getAccountAddress(): Promise<Address>

Get the smart account address.

isAccountDeployed(): Promise<boolean>

Check if the smart account is deployed on-chain.

Supported Chains

| Chain | Chain ID | USDT0 | USDC | | --------- | -------- | ----- | ---- | | Ethereum | 1 | ✅ | ✅ | | Arbitrum | 42161 | ✅ | ✅ | | Base | 8453 | ✅ | ✅ | | Optimism | 10 | ✅ | ✅ | | Ink | 57073 | ✅ | - | | Berachain | 80084 | ✅ | - | | Unichain | 130 | ✅ | - |

Constants

import {
  USDT0_ADDRESSES,
  USDC_ADDRESSES,
  CHAIN_IDS,
  getTokenAddress,
  getChainName,
} from '@t402/wdk-gasless'

// Get USDT0 address on Arbitrum
const usdt0 = USDT0_ADDRESSES.arbitrum
// '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'

// Get chain name from ID
const chainName = getChainName(42161)
// 'arbitrum'

Smart Account Architecture

This package uses Safe smart accounts with ERC-4337 support:

  • Safe Singleton: 0x29fcB43b46531BcA003ddC8FCB67FFE91900C762
  • Safe 4337 Module: 0xa581c4A4DB7175302464fF3C06380BC3270b4037 (v0.3.0)
  • Proxy Factory: 0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67
  • EntryPoint: 0x0000000071727De22E5E9d8BAf0edAc6f37da032 (v0.7)

Examples

Batch Payment

const result = await client.payBatch({
  payments: [
    { to: '0xAlice...', amount: 500000n }, // 0.5 USDT0
    { to: '0xBob...', amount: 300000n }, // 0.3 USDT0
    { to: '0xCharlie...', amount: 200000n }, // 0.2 USDT0
  ],
})

const receipt = await result.wait()
console.log(`Batch payment in tx: ${receipt.txHash}`)

Check Sponsorship

const sponsorship = await client.canSponsor({
  to: '0xRecipient...',
  amount: 1000000n,
})

if (sponsorship.canSponsor) {
  console.log('Payment will be free!')
} else {
  console.log(`Gas cost: ${sponsorship.estimatedGasCost} wei`)
}

Using USDC Instead

const result = await client.pay({
  to: '0xRecipient...',
  amount: 1000000n,
  token: 'USDC',
})

License

Apache-2.0