Skip to main content

@faremeter/wallet-solana

@faremeter/wallet-solana adapts a Solana Keypair to the interface expected by @faremeter/payment-solana. It is intentionally small—perfect for server-side agents or local testing where you control the secret key.

Quick start

import { createLocalWallet } from "@faremeter/wallet-solana";
import { Keypair } from "@solana/web3.js";

const wallet = await createLocalWallet("devnet", Keypair.generate());

const handler = createPaymentHandler(wallet, usdcMint, connection);

API surface

createLocalWallet(network, keypair)

  • network: string identifier ("devnet", "testnet", "mainnet-beta", etc.).
  • keypair: standard @solana/web3.js Keypair.
Returns an object with:
  • network: passed through unchanged.
  • publicKey: the keypair’s public key.
  • updateTransaction(tx): signs a VersionedTransaction in-place with the keypair and resolves the signed transaction.
Provide the result directly to @faremeter/payment-solana/exact.createPaymentHandler. If the handler or downstream flow defines sendTransaction, you can extend the returned object accordingly before passing it along.

Usage patterns

  • Server facilitators: Keep a dedicated keypair per environment, load it from secure storage, and create the wallet at startup.
  • Testing: Generate ephemeral keypairs for integration tests while exercising the full payment flow.
  • Composable adapters: Add your own helpers (e.g., sendTransaction) to the returned object to integrate with custom transaction broadcasters.
  • @faremeter/payment-solana: consumes the wallet and builds payment payloads.
  • @faremeter/wallet-crossmint, @faremeter/wallet-ledger: alternative adapters with richer functionality.
  • Source: GitHub › packages/wallet-solana