TransactionEnvelopeLegacy.hash
Hashes a TransactionEnvelopeLegacy.TransactionEnvelopeLegacy
. This is the "transaction hash".
Imports
Named
import { TransactionEnvelopeLegacy } from 'ox'
Examples
import { Secp256k1, TransactionEnvelopeLegacy } from 'ox'
const envelope = TransactionEnvelopeLegacy.from({
chainId: 1,
nonce: 0n,
gasPrice: 1000000000n,
gas: 21000n,
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: 1000000000000000000n,
})
const signature = Secp256k1.sign({
payload: TransactionEnvelopeLegacy.getSignPayload(envelope),
privateKey: '0x...'
})
const envelope_signed = TransactionEnvelopeLegacy.from(envelope, { signature })
const hash = TransactionEnvelopeLegacy.hash(envelope_signed)
Definition
function hash<presign>(
envelope: TransactionEnvelopeLegacy<presign extends true ? false : true>,
options?: hash.Options<presign>,
): hash.ReturnType
Source: src/TransactionEnvelopeLegacy.ts
Parameters
envelope
- Type:
TransactionEnvelopeLegacy<presign extends true ? false : true>
The Legacy Transaction Envelope to hash.
envelope.gasPrice
- Type:
bigintType
- Optional
Base fee per gas.
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
Error Type
TransactionEnvelopeLegacy.hash.ErrorType