Skip to content

TxEnvelopeEip4844.toRpc

Converts an TxEnvelopeEip4844.TxEnvelopeEip4844 to an TxEnvelopeEip4844.Rpc.

Imports

Named
import { TxEnvelopeEip4844 } from 'ox'

Examples

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

Definition

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

Source: src/core/TxEnvelopeEip4844.ts

Parameters

envelope

The EIP-4844 transaction envelope to convert.

Return Type

An RPC-formatted EIP-4844 transaction envelope.

Rpc