Skip to content

TransactionEnvelopeLegacy.getSignPayload

Returns the payload to sign for a TransactionEnvelopeLegacy.TransactionEnvelopeLegacy.

Imports

Named
import { TransactionEnvelopeLegacy } from 'ox'

Examples

The example below demonstrates how to compute the sign payload which can be used with ECDSA signing utilities like Secp256k1.sign.

import { Secp256k1, TransactionEnvelopeLegacy } from 'ox'
 
const envelope = TransactionEnvelopeLegacy.from({
  nonce: 0n,
  gasPrice: 1000000000n,
  gas: 21000n,
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: 1000000000000000000n,
})
 
const payload = TransactionEnvelopeLegacy.getSignPayload(envelope)
'0x...'
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })

Definition

function getSignPayload(
  envelope: TransactionEnvelopeLegacy<false>,
): getSignPayload.ReturnType

Source: src/core/TransactionEnvelopeLegacy.ts

Parameters

envelope

  • Type: TransactionEnvelopeLegacy<false>

The transaction envelope to get the sign payload for.

envelope.gasPrice

  • Type: bigintType
  • Optional

Base fee per gas.

Return Type

The sign payload.

getSignPayload.ReturnType