Open contract-facing SDK for payable routes and gateway-backed integrations
Thin public surface for payable code, authorize, checkout, and session-tank flows
Documentation • SDK Reference • GitHub • X/Twitter
████████╗ ██████╗ ███╗ ███╗
╚══██╔══╝ ██╔══██╗ ████╗ ████║
██║ ██║ ██║ ██╔████╔██║
██║ ██║ ██║ ██║╚██╔╝██║
██║ ██████╔╝ ██║ ╚═╝ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═╝
TDM SDK [OPEN SURFACE]
Routes + Contracts + Gateway Helpers
Mode: public-facing | Docs: todealmarket.com/docs
This GitHub repo shows the open contract-facing SDK surface for TDM:
- payable wrappers for application code
- route-first framework helpers
- thin clients around the public gateway contract
- small copy-paste examples for fast integration
This repo intentionally does not include:
- private gateway or treasury execution logic
- operator dashboards or setup UI
- unfinished control-plane tooling
- recovery, sweeper, or payout-operation internals
The public GitHub repo is intentionally thinner than the wider TDM beta distribution used across some onboarding docs.
- GitHub repo: open SDK surface for external review, grants, and integration analysis
- current npm beta: broader distribution used by the current CLI/operator onboarding path
That split is deliberate. It keeps the public developer surface auditable without exposing private control-plane implementation.
npm install tdm-sdkimport { chargeFetchHandler, createFetchHookClient } from "tdm-sdk";
const hooks = createFetchHookClient({
baseUrl: process.env.TDM_GATEWAY_URL ?? "https://tdm.todealmarket.com",
});
export const POST = chargeFetchHandler(
{
operation: "demo:route",
resourceId: "demo:route",
priceUsd: "0.05",
tokenResolver: (request: Request) =>
request.headers.get("x-tdm-token") ?? "demo-user",
hooks,
},
async (_request: Request) => Response.json({ ok: true }),
);import { createFetchHookClient, makePayable } from "tdm-sdk";
const hooks = createFetchHookClient({
baseUrl: "https://tdm.todealmarket.com",
});
const run = makePayable(
async (input: string) => `processed:${input}`,
{
operation: "demo:process",
tokenOrUuid: "demo-user",
priceUsd: "0.05",
hooks,
},
);
console.log(await run("hello"));import { createAuthorizeClient } from "tdm-sdk/authorize";
const authorize = createAuthorizeClient({
baseUrl: "https://tdm.todealmarket.com",
sessionToken: process.env.TDM_SESSION_TOKEN,
});
const result = await authorize.authorizePayment({
requestId: "req_demo_1",
tokenOrUuid: "demo-user",
operation: "demo:authorize",
priceUsd: "0.05",
});
console.log(result);import { createCheckoutClient } from "tdm-sdk/checkout";
const checkout = createCheckoutClient({
baseUrl: "https://tdm.todealmarket.com",
});
const session = await checkout.createSession({
resourceId: "res_demo_123",
chain: "solana",
});
console.log(session);import { createGatewayClients } from "tdm-sdk";
const clients = createGatewayClients({
baseUrl: "https://tdm.todealmarket.com",
sessionToken: process.env.TDM_SESSION_TOKEN,
});
await clients.authorize.authorizePayment({
requestId: "req_demo_2",
tokenOrUuid: "demo-user",
operation: "demo:authorize",
});
const checkout = await clients.checkout.createSession({
resourceId: "res_demo_123",
chain: "base",
});
console.log(checkout);tdm-sdktdm-sdk/authorizetdm-sdk/checkouttdm-sdk/fetch-hook-clienttdm-sdk/framework-modetdm-sdk/gateway-authtdm-sdk/gateway-clientstdm-sdk/gateway-transporttdm-sdk/local-402-circuittdm-sdk/local-vaulttdm-sdk/make-payabletdm-sdk/session-tanks
The repo ships intentionally small examples in examples/:
authorize-basic.tscheckout-basic.tsframework-mode-basic.tsgateway-clients-basic.tssession-tanks-basic.tsmake-payable-route.tsprotocol-first/*
The stable wire contract lives in tdm-protocol.
Use:
tdm-protocolwhen you need stable DTOs, schemas, headers, and response shapestdm-sdkwhen you want ergonomic wrappers around that contract
npm install
npm run build