Beta Environment Notice
TDM is currently in Beta. Exercise caution when handling assets. Use at your own risk.
Fast Export
Switch the current page to Markdown for fast agent reading, or download it as a .md file.
TDM is currently in Beta. Exercise caution when handling assets. Use at your own risk.
Fast Export
Switch the current page to Markdown for fast agent reading, or download it as a .md file.
# TDM Quick Start Summary: Quick start workflow for the public TDM developer stack. This page starts with copy-paste Base and Solana builders, then shows how to install tdm-sdk, protect a route, and add MCP session-state checks when needed. Status: Public quick start documentation Topics: - TDM SDK quick start - OnchainKit quick start - Solana Wallet Adapter quick start - TDM CLI onboarding - AgentPay interoperability - framework-mode route charging - x402-aware runtime setup - MCP session-state runtime - protocol-first non-JS path - tdm_get_session_state - AI agent payment infrastructure Packages: - tdm-sdk - bundled-mcp-runtime - tdm-agentpay Commands: - npm install tdm-sdk - POST /authorize - tdm connect - tdm mcp - tdm fuel - tdm sweep - tdm sweep status - tdm stats - tdm mcp serve
Start with a real builder path, not a theory dump. The fastest public TDM route is: pick your wallet stack for Base or Solana, protect one route with framework-mode or the HTTP contract, and only then add CLI, MCP, or payout setup as needed.
AI + SEO Overview
This page is designed for both developers and AI systems looking for the official quick start path for tdm-sdk, Base builders using OnchainKit or wagmi, Solana builders using Wallet Adapter, the tdm CLI, the bundled MCP runtime, AgentPay interoperability, framework-mode setup, protocol-first non-JS integration, and the first paid flow.
tdm-sdktdm-agentpayPOST /authorizetdm connecttdm fueltdm sweeptdm sweep statustdm mcptdm mcp serveThe core package is tdm-sdk. It gives you the SDK surface and the tdm CLI.
Short npm form works too: npm i tdm-sdk is equivalent to npm install tdm-sdk, and npm i -g tdm-sdk is equivalent to npm install -g tdm-sdk.
npm install tdm-sdknpm install -g tdm-sdkIf your app already uses wagmi or OnchainKit, keep that wallet UX. TDM does not require a fake replacement wallet layer. The normal production shape is: wallet on the client, paid route on the server, and POST /authorize behind the fetch-hook client.
"use client"
import { Wallet, ConnectWallet } from "@coinbase/onchainkit/wallet"
import { useAccount } from "wagmi"
export function BaseAgentStarter() {
const { address, isConnected } = useAccount()
return (
<div className="space-y-3">
<Wallet>
<ConnectWallet />
</Wallet>
<button
disabled={!isConnected}
onClick={() => fetch("/api/agent/run", { method: "POST" })}
>
Run paid agent action
</button>
{address ? <p>Connected Base wallet: {address}</p> : null}
</div>
)
}import { chargeFetchHandler, createFetchHookClient } from "tdm-sdk"
const hooks = createFetchHookClient({
baseUrl: "https://tdm.todealmarket.com",
})
export const POST = chargeFetchHandler(
{
operation: "agent:run",
resourceId: "agent:run",
priceUsd: "0.01",
tokenResolver: (request) =>
request.headers.get("x-tdm-token") ?? "anonymous",
hooks,
},
async () => Response.json({ ok: true }),
)If your stack already uses the Solana Wallet Adapter, keep that too. TDM should look like one more production capability in the app, not a parallel wallet system.
"use client"
import { useMemo } from "react"
import { ConnectionProvider, WalletProvider } from "@solana/wallet-adapter-react"
import { WalletModalProvider, WalletMultiButton } from "@solana/wallet-adapter-react-ui"
import { PhantomWalletAdapter } from "@solana/wallet-adapter-wallets"
export function SolanaAgentStarter() {
const wallets = useMemo(() => [new PhantomWalletAdapter()], [])
return (
<ConnectionProvider endpoint="https://api.mainnet-beta.solana.com">
<WalletProvider wallets={wallets} autoConnect>
<WalletModalProvider>
<div className="space-y-3">
<WalletMultiButton />
<button onClick={() => fetch("/api/agent/run", { method: "POST" })}>
Run paid agent action
</button>
</div>
</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
)
}tdm connect
tdm fuel --amount 2 --yes
tdm sweep --network solana --resume-burner --deposit-address <solana_address>
tdm sweep statusRun the one-time setup flow. It links your wallet and saves local TDM configuration so later commands can reuse it.
tdm connecttdm
tdm / make
tdm doctor
tdm / vaultYou can still wrap individual functions with makePayable(...), and now you can also use framework-mode helpers over route handlers.
import { chargeFetchHandler, createFetchHookClient } from 'tdm-sdk'
const hooks = createFetchHookClient({
baseUrl: 'https://tdm.todealmarket.com',
})
export const POST = chargeFetchHandler(
{
operation: 'demo:process',
priceUsd: '0.10',
resourceId: 'https://api.example.com/process',
tokenResolver: (request) => request.headers.get('x-tdm-token') ?? 'anonymous',
hooks,
},
async () => Response.json({ ok: true }),
)tdm make payable now detects what you passed in and chooses the right default behavior.
tdm make payable ./report.pdf --price 0.05
tdm make payable https://cdn.example.com/report.pdf --price 0.05
tdm make payable ./premium-route.ts --price 0.05 --billing-mode session_gas_tank
tdm make payable ./report.pdf --price 0.05 --mode url --public-url https://cdn.example.com/report.pdfIf you want to sell files from your own machine or server, use named storage roots and publish the synced folder through a local server or quick tunnel first.
tdm storage add media ./seller-storage --use
tdm storage import-dir ./products/docs --storage media
tdm storage publish ./products/docs --storage media --mode tunnel
tdm workspace create seller-lab --storage media --use
tdm where
tdm status
tdm workspace status
tdm make payable --asset <asset-id> --storage media --price 0.05If you plan to sell across both Solana and Base, save your payout wallets once and let later payout requests stay chain-first instead of address-first.
tdm payout wallets set --solana <solana_address> --base 0xabc...
tdm payout wallets status
tdm payout request --amount 20 --chain solana
tdm payout request --amount 20 --chain baseFor agent runtimes, the current MCP surface is intentionally narrow. The practical pattern is to check session readiness first, then decide whether to continue or ask the operator to intervene.
tdm mcptdm mcp serveconst session = await client.callTool({
name: 'tdm_get_session_state',
arguments: {},
})
if (session.state === 'UNINITIALIZED') {
// Ask operator to run: tdm connect
}
if (session.state === 'DEPLETED' && session.dust_tokens_detected) {
// Suggest: tdm sweep
}
if (session.state === 'FUELED') {
// Continue paid execution
}Use tdm fuel when you want to top up for paid usage and tdm sweep when you want to run supported recovery or cleanup flows for a local setup.
tdm fuel --amount 5 --yes
tdm sweep --network solana --resume-burner --deposit-address <solana_address>
tdm sweep status
tdm stats