Accounts SDK for Apps building on Tempo
Website · Docs · Install · Examples · Development
Prompt your agent:
Read accounts.tempo.xyz and integrate Tempo into my application
npm i accounts viempnpm i accounts viembun i accounts viemCreate 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 })Start at accounts.tempo.xyz for the product overview and integration guides. The documentation lives at accounts.tempo.xyz/docs.
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
| 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. |
tempoxyz/id holds one playground per flow, which uses accounts, deployed beside https://id.tempo.xyz.
| Playground | Directory | URL |
|---|---|---|
| API | playgrounds/api |
id-playground-api.tempo.xyz/me |
| Backend | playgrounds/backend |
id-playground-backend.tempo.xyz |
| CLI | playgrounds/cli |
none |
| Mobile | playgrounds/mobile |
none |
| Third-party | playgrounds/third-party |
none |
| Wagmi | playgrounds/wagmi |
id-playground-wagmi.tempo.xyz |
| Web | playgrounds/web |
id-playground-web.tempo.xyz |
| Web (Cash) | playgrounds/web |
id-playground-web-cash.tempo.xyz |
| Web (Shared) | playgrounds/web |
id-playground-web-shared.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.01pnpm build # build library
pnpm check # lint + format
pnpm check:types # type checks
pnpm test # run testsEach 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!:, or a feat: title raises <minor>. No title raises <breaking>. A caret range therefore also resolves a release with breaking changes, which its GitHub release lists under "Breaking changes". scripts/release.ts picks the version.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in these packages by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.