# Setup

Setup the Tempo extension for Viem by following the steps below.

::::steps
## Install

To install the Tempo extension, you will need to install [Viem](https://viem.sh) and Tempo:

:::code-group
```bash [npm]
npm i tempo.ts viem
```

```bash [pnpm]
pnpm i tempo.ts viem
```
:::

## Configure

Next, we will configure a [Viem Client](/docs/clients/custom).

```ts twoslash [viem.config.ts]
// [!include ~/snippets/tempo/viem.config.ts:setup]
```

## Use Viem Actions

Once we have configured our Viem client with Tempo, we can then use regular Viem actions (e.g. `sendTransactionSync`)
that are decorated with [Tempo properties](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction)
like `calls` (batch transactions), `feePayer` (fee sponsorship), `nonceKey` (concurrent transactions) and more!

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const receipt = await client.sendTransactionSync({
  calls: [
    {
      data: '0xcafebabe00000000000000000000000000000001',
      to: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
    },
    {
      data: '0xdeadbeef00000000000000000000000000000002',
      to: '0xfeedfacefeedfacefeedfacefeedfacefeedface'
    },
    {
      data: '0xfeedface00000000000000000000000000000003',
      to: '0xfeedfacefeedfacefeedfacefeedfacefeedface'
    },
  ],
  feePayer: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
  nonceKey: 1337n,
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

:::tip
[See all Viem Actions](https://viem.sh/docs/actions/public/introduction)
:::

## Use Tempo Actions

You can also use [Tempo-specific Actions](/tempo/actions):

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const alphaUsd = '0x20c0000000000000000000000000000000000001'

const metadata = await client.token.getMetadata({ 
  token: alphaUsd 
})

console.log(
  'Alpha USD Metadata:', 
  metadata.name,
  metadata.symbol,
  metadata.logoURI,
  metadata.decimals,
  metadata.totalSupply
)
// @log: Alpha USD Metadata: Alpha USD, AlphaUSD, https://example.com/token.svg, 6, 1000000000000000000000n
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

:::tip
[See all Tempo Actions](/tempo/actions)
:::

## Next Steps

After you have set up Tempo with Viem, you can now:

* Follow a guide on how to [use accounts](https://docs.tempo.xyz/guide/use-accounts), [make payments](https://docs.tempo.xyz/guide/payments), [issue stablecoins](https://docs.tempo.xyz/guide/issuance), [exchange stablecoins](https://docs.tempo.xyz/guide/stablecoin-exchange), and [more](/).
* Use the [suite of Tempo Actions](/tempo/actions)
::::
