Skip to main content
@faremeter/rides is the simplest way to use faremeter. It bundles all payment handlers and wallet adapters into a single package with automatic wallet detection.

Basic usage

The payer singleton

payer is a pre-configured singleton with sensible defaults. It supports all chains and assets out of the box.

addLocalWallet

Adds a wallet to the payer. Auto-detects the wallet type:
  • File path (e.g., ~/.config/solana/id.json) — Treated as a Solana keypair file.
  • JSON array (e.g., [123, 45, ...]) — Treated as Solana keypair bytes.
  • Base64 string — Treated as a Solana keypair.
  • Hex string starting with 0x — Treated as an EVM private key.
Multiple wallets can be added. The payer will use the first wallet that matches a payment requirement.

addWalletAdapter

Registers a wallet adapter directly. Use this for wallet types that addLocalWallet cannot auto-detect, such as OWS, Ledger, or Crossmint wallets. A WalletAdapter has three fields: Example with an OWS Solana wallet:

fetch

Drop-in replacement for the global fetch. If the server responds with 402, rides handles payment negotiation and retries the request automatically.

createPayer

For more control, create a custom payer instance:

Options

Multi-chain support

Add wallets for different chains. Rides selects the correct one based on the server’s payment requirements.

When to use rides vs fetch

Use rides when:
  • You want the fastest setup with minimal configuration.
  • You do not need custom payer selection logic.
  • You are building a simple agent or script.
Use @faremeter/fetch when:
  • You need custom payment handlers or payer choosers.
  • You want to control which handlers are registered.
  • You need separate fetch instances with different configurations.
See Fetch Wrapper for the lower-level approach.