> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set a validity window

> Limit when a Tempo transaction can be included with the validAfter and validBefore fields of sendTempoTransaction

A validity window limits the time during which the network can include a transaction. `validAfter` sets the earliest time and `validBefore` sets the time after which the transaction expires. Set a window when a delayed transaction must not land after your app has given up on it, or when you sign a payment ahead of the time it should take effect.

## Set the window

Both fields are Unix timestamps in seconds, and both are optional. Pass them to [`sendTempoTransaction`](/docs/javascript/reference/tempo/overview#send-a-tempo-transaction).

```typescript theme={"system"}
import type { TempoWalletAccount } from '@dynamic-labs-sdk/tempo';
import { sendTempoTransaction } from '@dynamic-labs-sdk/tempo/waas';
import { encodeFunctionData, erc20Abi, parseUnits } from 'viem';

const sendWithinFiveMinutes = async (walletAccount: TempoWalletAccount) => {
  const nowInSeconds = Math.floor(Date.now() / 1000);

  const { transactionHash } = await sendTempoTransaction({
    calls: [
      {
        data: encodeFunctionData({
          abi: erc20Abi,
          args: ['0xRecipientAddress...', parseUnits('1.5', 6)],
          functionName: 'transfer',
        }),
        to: '0xTip20TokenAddress...',
      },
    ],
    validBefore: nowInSeconds + 5 * 60,
    walletAccount,
  });

  return transactionHash;
};
```

Pass `validAfter` as well to delay the earliest inclusion. A transaction that is not included by `validBefore` can no longer be included, so your app should treat it as not sent and may retry with a new window.

## Rules

Both values must be non-negative integers, so use `Math.floor` on a millisecond clock divided by 1000. If you set both, `validAfter` must be earlier than `validBefore`, and equal values are rejected. A value that breaks these rules throws `TempoTransactionValidationError` before the wallet signs, with the reason naming the field.

## Related

* [Use parallel nonce lanes](/docs/javascript/reference/tempo/use-parallel-nonce-lanes) sends independent transactions without queuing them behind each other.
* [Tempo](/docs/javascript/reference/tempo/overview) lists every `sendTempoTransaction` parameter and error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.