Quick Prompt
Prompt your agent:
Read accounts.tempo.xyz and integrate Tempo into my application
Install
npm i accounts viem
pnpm i accounts viem
bun i accounts viem
Usage
Create an instance with Accounts.create, and add a plugin from accounts/plugins for each sign-in method. Without a sign-in plugin, users sign in through Tempo ID in a dialog on the page:
import { Accounts } from 'accounts'
import { viem } from 'accounts/plugins'
const accounts = Accounts.create({
// Each sign-in requests an access key that may spend up to 10 OUSD for a day.
accessKey: {
expiry: '1d',
limits: [{ limit: '10', token: 'ousd' }],
},
plugins: [viem()],
})
await accounts.dialog.signIn()
await accounts.pay({ amount, to, token })
Documentation
Start at accounts.tempo.xyz for the product overview and integration guides. The documentation lives at accounts.tempo.xyz/docs.
Getting Help
Have questions or building something cool with the Tempo Accounts SDK?
Join the Telegram group to chat with the team and other devs: @mpp_devs
Examples
| Example |
Description |
| web |
Sign in through a dialog on the page, and send OUSD with the access key. |
| authenticated-api |
Sign in through a dialog that the backend runs, call the app's API with a cookie, and pay OUSD. |
| wagmi |
Sign in through wagmi's connect, with the tempoId connector. |
| backend |
Sign in through a redirect, with the session on a Cloudflare Worker. |
| siwe |
Sign in with a SIWE message that a Worker issues, and approve a deletion with another message. |
| siwe-pay |
Pay and sign in with one click, with the siwe plugin's auth and a Worker in token mode. |
| mpp-subscription |
Approve an MPP subscription once, which a merchant's Worker charges each period. |
| sponsored-self-hosted |
Send OUSD whose fees the app's own fee payer pays, through a guarded relay route. |
| sponsored-tempo-api |
Send OUSD whose fees the sponsor of the app's Tempo API key pays, through a guarded relay route. |
| cli |
Sign in through the device grant, with a code approved in a browser. |
| mobile |
Sign in through the system browser in an Expo app. |
| mpp-charge |
Pay an MPP charge once, with a transfer that the access key signs. |
| mpp-session |
Pay a metered API in an MPP session, over HTTP, SSE, and a WebSocket. |
| mcp |
Sign an agent in once for a paid MCP server, and pay each tool call with the access key. |
Playgrounds
tempoxyz/id holds one playground per flow, which uses accounts, deployed beside https://id.tempo.xyz.
Web (Cash) signs in to the Tempo Cash realm, and Web (Shared) to both realms.
To run the CLI playground against https://id.tempo.xyz, run its main prerelease with pnpx:
export TEMPO_ID_URL=https://id.tempo.xyz
pnpx @tempoxyz/example-id-cli@main login # approve the code on /device
pnpx @tempoxyz/example-id-cli@main whoami # print the signed-in account
pnpx @tempoxyz/example-id-cli@main fund # fund the Tempo Account from the testnet faucet
pnpx @tempoxyz/example-id-cli@main send 0x000000000000000000000000000000000000dEaD 0.01
Development
pnpm build # build library
pnpm check # lint + format
pnpm check:types # type checks
pnpm test # run tests
Releases
Each push to main publishes to npm through trusted publishing, from .github/workflows/release.yml, as <breaking>.<minor>.<commit time> under latest, such as 1.2.20261118194700, so accounts installs the current commit of main, and a caret range resolves each later release. A breaking pull request title, such as feat!:, raises <breaking>, and a feat: title raises <minor>. scripts/release.ts picks the version.
License