Skip to content
LogoLogo

Getting Started

Overview

The Tempo Accounts SDK is a TypeScript library for applications and wallets to create, manage, and interact with accounts on Tempo.

Demo

Try sign in and make a payment on Tempo using the Accounts SDK.

Make a Payment

demo
1
Create an account, or use an existing one.
2
Add testnet funds to your account.
3
Send 100 AlphaUSD to a recipient.
pnpx gitpick tempoxyz/accounts/tree/main/examples/basic

Quick Prompt

You can integrate the Accounts SDK, and achieve a flow like the demo above by prompting your agent:

Read docs.tempo.xyz/accounts and integrate Tempo Wallet into my application

Architecture

The Accounts SDK is a router between your application and a signing Adapter (e.g. the Tempo Wallet dialog), exposed as an EIP-1193 Provider.

Adapters handle where keys live and who handles signing. The Accounts SDK currently ships with two adapters:

AdapterDescription
Tempo WalletDelegates signing to wallet.tempo.xyz via an iframe dialog or popup. One passkey, one account, portable across apps.
Domain-bound PasskeysThe app (or wallet) handles passkey ceremonies and signing in-process on its own domain.

Your application interacts with the SDK through standard JSON-RPC methods (via Wagmi or Viem).

An example of a high-level flow of an Application requesting for a user to perform an action with their Tempo Wallet is shown below:

Install

The Tempo Accounts SDK is available as an NPM package under accounts

Wagmi Usage

The Tempo Accounts SDK is best used in conjunction with Wagmi to provide a seamless experience for developers and end-users.

Set up Wagmi

Get started with Wagmi by following the official guide.

Configure

After you have set up Wagmi, you can set up the Tempo Accounts SDK by using a Connector from accounts/wagmi.

import { ,  } from 'wagmi'
import {  } from 'wagmi/chains'
import {  } from 'accounts/wagmi'
 
export const  = ({
  : [],
  : [()], 
  : {
    [.]: (),
  },
})

Use Accounts

You can now use Wagmi Hooks like useConnect, or Tempo Hooks like useTransfer.

import { ,  } from 'wagmi'
 
function () {
  const  = ()
  const  = ()
 
  return ?.(() => (
    <
      ={.}
      ={() => .({  })}
    >
      Connect
    </>
  ))
}

Vanilla + Viem Usage

You can get started with the Tempo Accounts SDK by creating a new Provider instance. Once set up, you can use the provider to interact with accounts via JSON-RPC, or use Viem Actions with .getClient().

import {  } from 'accounts'
import {  } from 'viem'
import {  } from 'viem/tempo'
 
const  = .()
 
const {  } = await .({
  : 'wallet_connect',
})
 
const  = .().(())
 
const {  } = await ..({
  : '0x20c0000000000000000000000000000000000001',
  : '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  : ('10', 6),
})

Examples

Check out these examples to get started with the Tempo Accounts SDK.

ExampleDescription
Embed Tempo WalletWagmi-based setup using the tempoWallet connector to connect to Tempo Wallets.Guide
Embed Domain-bound PasskeysDomain-bound passkey example using Wagmi and the webAuthn connector.Guide
CLI + Tempo WalletsMinimal CLI setup to connect and authorize local keys using Tempo Wallets.
Access Keys + Tempo WalletsAuthorize access keys using Tempo Wallets to submit transactions without prompts.
Access Keys + Domain-bound PasskeysAuthorize access keys using domain-bound Passkeys.
Sponsor Fees + Tempo WalletsSponsor transactions via Tempo Wallets.Guide
Sponsor Fees + Domain-bound PasskeysSponsor transactions via domain-bound Passkeys.Guide

Secure Origins (HTTPS)

The Tempo Accounts SDK is designed to be used on secure origins (HTTPS). If you are using HTTP, it will fallback to using a popup instead of an iframe. This is because WebAuthn is not supported on iframes embedded on insecure origins (HTTP).

Web frameworks typically default to HTTP in development environments. You will need to ensure to turn on HTTPS in development to leverage the iframe dialog.

Portless

Portless replaces port numbers with stable, named .localhost URLs and can enable HTTPS with auto-generated certificates.

npm install -g portless
portless run dev
# → https://myapp.localhost

Next.js

HTTPS can be enabled on Next.js' dev server by setting the --experimental-https flag on the next dev command.

next dev --experimental-https

Vite

HTTPS can be enabled on Vite's dev server by installing and configuring the vite-plugin-mkcert plugin.

npm i vite-plugin-mkcert
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import mkcert from 'vite-plugin-mkcert'
 
export default defineConfig({
  plugins: [
    mkcert(),
    react(),
  ],
})

Getting Help

Have questions or building something cool with the Accounts SDK?

Join the Telegram group to chat with the team and other devs: @mpp_devs