Skip to content

TxEnvelopeEip8141.fromRpc

Converts an RPC envelope to an EIP-8141 envelope without losing chain ID precision.

Imports

Named
import { TxEnvelopeEip8141 } from 'ox'

Examples

Basic Usage

import { Frame, TxEnvelopeEip8141 } from 'ox'
 
const rpc = TxEnvelopeEip8141.toRpc(
  TxEnvelopeEip8141.from({
    chainId: 1,
    frames: [Frame.from({})],
    sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
  })
)
const envelope = TxEnvelopeEip8141.fromRpc(rpc)

Definition

function fromRpc(
  envelope: Rpc,
): TxEnvelopeEip8141

Source: src/core/TxEnvelopeEip8141.ts

Parameters

envelope

  • Type: Rpc

The value to convert.

envelope.blobVersionedHashes

  • Type: readonly 0x${string}[]

Versioned blob hashes.

envelope.chainId

  • Type: 0x${string}

Chain ID.

envelope.frames

  • Type: readonly Rpc[]

Frames in execution order.

envelope.from

  • Type: abitype_Address

Account authorizing execution.

envelope.maxFeePerBlobGas

  • Type: 0x${string}

Maximum fee per blob gas.

envelope.maxFeePerGas

  • Type: 0x${string}

Maximum fee per gas.

envelope.maxPriorityFeePerGas

  • Type: 0x${string}

Maximum priority fee per gas.

envelope.nonce

  • Type: 0x${string}

Sender nonce.

envelope.signatures

  • Type: readonly Rpc[]

Frame signature entries.

envelope.type

  • Type: "0x6"

RPC transaction type.

Return Type

The converted value.

TxEnvelopeEip8141.TxEnvelopeEip8141