Skip to content

Latest commit

 

History

History
241 lines (173 loc) · 8.74 KB

File metadata and controls

241 lines (173 loc) · 8.74 KB
description Integrate Tempo into your wallet. Use Tempo Transactions for fee token selection, fee sponsorship, batching, and concurrent execution.
showOutline 1

import { Cards, Card } from 'vocs'

Wallet Developer Guide

Tempo is EVM-compatible, so standard transactions work out of the box. However, Tempo has no native gas token, which means wallet behaviors like balance display and gas quoting need adjustment.

To deliver the best experience for your users, integrate Tempo Transactions — a protocol-native EIP-2718 transaction type (type byte 0x76) that provides fee token selection, fee sponsorship, call batching, concurrent nonces, passkey signing, and scheduled execution — without requiring a bundler, paymaster, or third-party vendor.

SDKs are available for TypeScript, Rust, Go, Python, and Foundry. Integration typically takes less than an hour.

Steps

::::steps

Integrate Tempo Transactions

Replace your wallet's transaction construction with Tempo Transactions. The minimum change is switching from a type-2 (EIP-1559) envelope to a type-0x76 Tempo Transaction envelope using one of the Tempo SDKs.

:::code-group

// @noErrors
import { client } from './viem.config'
import { parseUnits } from 'viem'

// Sends a Tempo Transaction (type 0x76)
const { receipt } = await client.token.transferSync({
  amount: parseUnits('100', 6),
  to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  token: '0x20c0000000000000000000000000000000000001',
})
// [!include ~/snippets/viem.config.ts:setup]

:::

:::tip With Tempo Transactions, you can also:

  • Set the fee token for your users' transactions (guide)
  • Sponsor transaction fees for your users (guide)
  • Send concurrent transactions with independent nonces (guide)
  • Batch multiple calls into a single atomic transaction (guide)
  • Sign with passkeys and P256 keys (guide)
  • Use expiring nonces for cheaper transactions that don't require nonce tracking (guide) :::

Handle the absence of a native token

If you use eth_getBalance to validate a user's balance, you should instead check the user's account fee token balance on Tempo. Additionally, you should not display any "native balance" in your UI for Tempo users.

:::info In testnet, eth_getBalance returns a large placeholder value for the native token balance to unblock existing assumptions wallets have about the native token balance. :::

:::code-group

// @noErrors
import { client } from './viem.config'

const userFeeToken = await client.fee.getUserToken({
  account: '0x...'
})

const balance = await client.token.getBalance({
  account: '0x...',
  token: userFeeToken.address
})
// [!include ~/snippets/viem.config.ts:setup]

:::

Configure native currency symbol

If you need to display a native token symbol, such as showing how much gas a transaction requires, you can set the currency symbol to USD for Tempo as fees are denominated in USD.

Use fee token preferences to quote gas prices

On Tempo, users can pay fees in any supported stablecoin. You should quote gas/fee prices in your UI based on a transaction's fee token.

:::info As a wallet developer, you can set the fee token for your user at the account level.

If you don't, Tempo uses a cascading fee token selection algorithm to determine the fee token for a transaction – learn more about Fee Token Preferences. :::

Add fee token selection to your UI

Your wallet should provide a way for users to choose which stablecoin they pay fees in. This can be a dropdown in the transaction confirmation screen or a setting in account preferences.

To set the fee token on a per-transaction basis, pass the feeToken parameter when submitting a Tempo Transaction:

:::code-group

// @noErrors
import { client } from './viem.config'
import { parseUnits } from 'viem'

const { receipt } = await client.token.transferSync({
  amount: parseUnits('100', 6),
  feeToken: '0x20c0000000000000000000000000000000000002', // [!code hl]
  to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  token: '0x20c0000000000000000000000000000000000001',
})
// [!include ~/snippets/viem.config.ts:setup]

:::

To set a persistent default so users don't need to select on every transaction, use setUserToken:

await client.fee.setUserTokenSync({
  token: '0x20c0000000000000000000000000000000000001',
})

See Fee Token Preferences for the full cascading resolution order.

Display token and network assets

Tempo provides a public tokenlist service that hosts token and network assets. You can pull these assets from our public tokenlist service to display in your UI.

::::

Already using EIP-7702 or EIP-4337?

If you've integrated a third-party account abstraction provider for batching, sponsorship, or smart accounts, Tempo Transactions provide these features natively at the protocol level. See the feature comparison for details.

Recipes

Get user's fee token

Retrieve the user's configured fee token preference:

import { getUserToken } from 'viem/tempo'

const feeToken = await client.fee.getUserToken({
  account: userAddress
})

See getUserToken for full documentation.

Get token balance

Check a user's balance for a specific token:

import { getBalance } from 'viem/tempo'

const balance = await client.token.getBalance({
  account: userAddress,
  token: tokenAddress
})

See getBalance for full documentation.

Set user fee token

Set the user's default fee token preference. This will be used for all transactions unless a different fee token is specified at the transaction level.

import { setUserToken } from 'viem/tempo'

await client.fee.setUserTokenSync({
  token: '0x20c0000000000000000000000000000000000001',
})

See setUserToken for full documentation.

Checklist

Before launching Tempo support, ensure your wallet:

  • [ ] Integrates Tempo Transactions for transaction submission
  • [ ] Checks fee token balance instead of native balance
  • [ ] Hides or removes native balance display for Tempo
  • [ ] Displays USD as the currency symbol for gas
  • [ ] Quotes gas prices in the user's fee token
  • [ ] Provides fee token selection in the UI (dropdown or account setting)
  • [ ] Pulls token/network assets from Tempo's tokenlist
  • [ ] (Recommended) Sponsors fees for your users via fee sponsorship
  • [ ] (Recommended) Uses expiring nonces for lower-cost transactions that don't require nonce management

Learning Resources