Skip to Content
px402Devnet
SDK

SDK overview

The TypeScript library behind the px402 command.

npm install @px402-tech/sdk

It runs on Node 22.13 or later and on Bun. See Install.

ExportWhat it does
loadAgentSdkConfig(env?)Reads and checks the PX402_* variables
openAgentWallet(options)Opens the profile’s keys and the Rings client
createPaidFetch(options)A fetch that pays a 402 within your limits
openJournal({ path, caps })The local record of every payment
resolveCaps, readStoredCaps, writeStoredCaps, evaluateCapsSpending caps
createProfileKey, profileAddressesCreate and read a profile’s key, without network
withdrawAllMove the whole private balance to a public address
parseUsdc, formatUsdcConvert between USDC text and base units
hostedLogin, openHostedClient, hostedLogoutHosted mode
createPlatformClientProvider platform calls
AgentErrorEvery local error, with a code

Amounts are bigint base units in code: 10000n is 0.01 USDC.