Skip to content

TransactionEnvelopeEip4844.toRpc

Converts an TransactionEnvelopeEip4844.TransactionEnvelopeEip4844 to an TransactionEnvelopeEip4844.Rpc.

Imports

Named
import { TransactionEnvelopeEip4844 } from 'ox'

Examples

import { Blobs, RpcRequest, TransactionEnvelopeEip4844, Value } from 'ox'
import { kzg } from './kzg'
 
const blobs = Blobs.from('0xdeadbeef')
const blobVersionedHashes = Blobs.toVersionedHashes(blobs, { kzg })
 
const envelope = TransactionEnvelopeEip4844.from({
  blobVersionedHashes,
  chainId: 1,
  nonce: 0n,
  gas: 21000n,
  maxFeePerBlobGas: Value.fromGwei('20'),
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: Value.fromEther('1'),
})
 
const envelope_rpc = TransactionEnvelopeEip4844.toRpc(envelope)
 
const request = RpcRequest.from({
  id: 0,
  method: 'eth_sendTransaction',
  params: [envelope_rpc],
})

Definition

function toRpc(
  envelope: TransactionEnvelopeEip4844.TransactionEnvelopeEip4844,
): Rpc

Source: src/TransactionEnvelopeEip4844.ts

Parameters

envelope

The EIP-4844 transaction envelope to convert.

Return Type

An RPC-formatted EIP-4844 transaction envelope.

Rpc