Skip to content

TransactionEnvelopeEip7702.hash

Hashes a TransactionEnvelopeEip7702.TransactionEnvelopeEip7702. This is the "transaction hash".

Imports

Named
import { TransactionEnvelopeEip7702 } from 'ox'

Examples

import { Secp256k1, TransactionEnvelopeEip7702 } from 'ox'
 
const envelope = TransactionEnvelopeEip7702.from({
  authorizationList: [...],
  chainId: 1,
  nonce: 0n,
  maxFeePerGas: 1000000000n,
  gas: 21000n,
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: 1000000000000000000n,
})
 
const signature = Secp256k1.sign({
  payload: TransactionEnvelopeEip7702.getSignPayload(envelope),
  privateKey: '0x...'
})
 
const envelope_signed = TransactionEnvelopeEip7702.from(envelope, { signature })
 
const hash = TransactionEnvelopeEip7702.hash(envelope_signed)

Definition

function hash<presign>(
  envelope: TransactionEnvelopeEip7702<presign extends true ? false : true>,
  options?: hash.Options<presign>,
): hash.ReturnType

Source: src/core/TransactionEnvelopeEip7702.ts

Parameters

envelope

  • Type: TransactionEnvelopeEip7702<presign extends true ? false : true>

The EIP-7702 Transaction Envelope to hash.

envelope.accessList

  • Type: readonly { address: abitype_Address; storageKeys: readonly 0x${string}[]; }[]
  • Optional

EIP-2930 Access List.

envelope.authorizationList

  • Type: readonly { address: abitype_Address; chainId: numberType; nonce: bigintType; r: bigintType; s: bigintType; yParity: numberType; }[]

EIP-7702 Authorization List.

envelope.chainId

  • Type: numberType

EIP-155 Chain ID.

envelope.data

  • Type: 0x${string}
  • Optional

Contract code or a hashed method call with encoded args

envelope.from

  • Type: Address.Address | undefined
  • Optional

Sender of the transaction.

envelope.gas

  • Type: bigintType
  • Optional

Gas provided for transaction execution

envelope.input

  • Type: 0x${string}
  • Optional

envelope.maxFeePerGas

  • Type: bigintType
  • Optional

Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas).

envelope.maxPriorityFeePerGas

  • Type: bigintType
  • Optional

Max priority fee per gas (in wei).

envelope.nonce

  • Type: bigintType
  • Optional

Unique number identifying this transaction

envelope.r

  • Type: bigintType

envelope.s

  • Type: bigintType

envelope.to

  • Type: Address.Address | null | undefined
  • Optional

Transaction recipient

envelope.type

  • Type: type

Transaction type

envelope.v

  • Type: numberType
  • Optional

envelope.value

  • Type: bigintType
  • Optional

Value in wei sent with this transaction

envelope.yParity

  • Type: numberType
  • Optional

ECDSA signature yParity.

options

  • Type: hash.Options<presign>
  • Optional

Options.

options.presign

  • Type: boolean | presign
  • Optional

Whether to hash this transaction for signing.

Return Type

The hash of the transaction envelope.

hash.ReturnType