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.
| Export | What 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, evaluateCaps | Spending caps |
createProfileKey, profileAddresses | Create and read a profile’s key, without network |
withdrawAll | Move the whole private balance to a public address |
parseUsdc, formatUsdc | Convert between USDC text and base units |
hostedLogin, openHostedClient, hostedLogout | Hosted mode |
createPlatformClient | Provider platform calls |
AgentError | Every local error, with a code |
Amounts are bigint base units in code: 10000n is 0.01 USDC.