Skip to content

TxEnvelopeTempo

Utilities for instantiating, serializing, and hashing Tempo transaction envelopes.

Create, sign, and serialize Tempo transactions with support for configurable fee tokens, call batching, fee sponsorship, access keys, and scheduled execution via validAfter/validBefore.

Tempo Transaction Specification

Examples

import { Secp256k1, Value } from 'ox'
import { TxEnvelopeTempo } from 'ox/tempo'
 
const envelope = TxEnvelopeTempo.from({
  chainId: 1,
  calls: [{ to: '0x0000000000000000000000000000000000000000', data: '0xdeadbeef' }],
  maxFeePerGas: Value.fromGwei('10'),
})
 
const payload = TxEnvelopeTempo.getSignPayload(envelope)
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
 
const envelope_signed = TxEnvelopeTempo.from(envelope, { signature })
const envelope_serialized = TxEnvelopeTempo.serialize(envelope_signed)

Functions

NameDescription
TxEnvelopeTempo.assertAsserts a TxEnvelopeTempo.TxEnvelopeTempo is valid.
TxEnvelopeTempo.deserializeDeserializes a TxEnvelopeTempo.TxEnvelopeTempo from its serialized form.
TxEnvelopeTempo.fromConverts an arbitrary transaction object into a Tempo Transaction Envelope.
TxEnvelopeTempo.getFeePayerSignPayloadReturns the fee payer payload to sign for a TxEnvelopeTempo.TxEnvelopeTempo.
TxEnvelopeTempo.getSignPayloadReturns the payload to sign for a TxEnvelopeTempo.TxEnvelopeTempo.
TxEnvelopeTempo.hashHashes a TxEnvelopeTempo.TxEnvelopeTempo. This is the "transaction hash".
TxEnvelopeTempo.serializeSerializes a TxEnvelopeTempo.TxEnvelopeTempo.
TxEnvelopeTempo.validateValidates a TxEnvelopeTempo.TxEnvelopeTempo. Returns true if the envelope is valid, false otherwise.

Errors

NameDescription
TxEnvelopeTempo.CallsEmptyErrorThrown when a transaction's calls list is empty.
TxEnvelopeTempo.InvalidValidityWindowErrorThrown when validBefore is not greater than validAfter.

Types

NameDescription
TxEnvelopeTempo.CallRepresents a single call within a Tempo transaction.
TxEnvelopeTempo.FeePayerMagic
TxEnvelopeTempo.Rpc
TxEnvelopeTempo.Serialized
TxEnvelopeTempo.SerializedType
TxEnvelopeTempo.Signed
TxEnvelopeTempo.TxEnvelopeTempoTempo transaction envelope (type 0x76).
TxEnvelopeTempo.Type