Skip to content

TransactionEnvelopeLegacy.toRpc

Converts an TransactionEnvelopeLegacy.TransactionEnvelopeLegacy to an TransactionEnvelopeLegacy.Rpc.

Imports

Named
import { TransactionEnvelopeLegacy } from 'ox'

Examples

import { RpcRequest, TransactionEnvelopeLegacy, Value } from 'ox'
 
const envelope = TransactionEnvelopeLegacy.from({
  chainId: 1,
  nonce: 0n,
  gas: 21000n,
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: Value.fromEther('1'),
})
 
const envelope_rpc = TransactionEnvelopeLegacy.toRpc(envelope)
 
const request = RpcRequest.from({
  id: 0,
  method: 'eth_sendTransaction',
  params: [envelope_rpc],
})

Definition

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

Source: src/core/TransactionEnvelopeLegacy.ts

Parameters

envelope

The legacy transaction envelope to convert.

Return Type

An RPC-formatted legacy transaction envelope.

Rpc