TypeScript SDK

@algodev-studio/algopay — guards, ledger, intents, payments, and x402 for Node.js.

Install

npm install @algodev-studio/algopay

Quick Start

import { AlgoPay, Config } from "@algodev-studio/algopay";

const config = Config.fromEnv();
const ap = new AlgoPay(config);

// Create a wallet
const wallet = await ap.wallet.create("my-agent");

// Send USDC
const result = await ap.pay({
  walletId: wallet.id,
  to: "RECIPIENT_ADDRESS",
  amount: 5.00,
  purpose: "Service fee",
});

console.log(result.txId);

API Map (Python ↔ TypeScript)

PythonTypeScript
AlgoPay()new AlgoPay(config)
ap.pay(...)await ap.pay({...})
ap.wallet.create(name)await ap.wallet.create(name)
ap.wallet.balance(id)await ap.wallet.balance(id)
ap.x402_fetch(url, ...)await ap.x402Fetch(url, ...)
BudgetGuard(max_usdc=100)new BudgetGuard({ maxUsdc: 100 })
ap.ledger.entries()await ap.ledger.entries()
ap.intents.create(...)await ap.intents.create({...})

Guards

import {
  AlgoPay,
  BudgetGuard,
  SingleTxGuard,
  RecipientGuard,
  RateLimitGuard,
} from "@algodev-studio/algopay";

const ap = new AlgoPay({
  guards: [
    new BudgetGuard({ maxUsdc: 100, windowHours: 24 }),
    new SingleTxGuard({ maxUsdc: 25 }),
    new RecipientGuard({ allowlist: ["ADDR1", "ADDR2"] }),
    new RateLimitGuard({ maxPerHour: 20 }),
  ],
});

Configuration

# Environment variables
ALGOPAY_NETWORK=algorand-testnet
ALGOD_URL=https://testnet-api.algonode.cloud
INDEXER_URL=https://testnet-idx.algonode.cloud
ALGOPAY_USDC_ASA_ID=10458941