Skip to content

Call.make

Builds a raw call: no function and no ABI, the bytes as they are, to an address or as a deployment.

import { Call, type Address, type Hex } from "@ethect/core";
const calls = (treasury: Address.Address, bytecode: Hex.Hex) => [
// a transfer of ether: no data
Call.make({ to: treasury, value: 10n ** 17n }),
// calldata you have already: from another library, from a relayer
Call.make({ to: treasury, data: "0xd0e30db0", value: 1n }),
// a deployment: no address, the creation code as data
Call.make({ data: bytecode }),
];

A raw call is sent like any other, alone or beside calls of functions, with Tx.

Call.Call<Hex.Hex, never>

A call without a function. What it returns is bytes, and it declares no error. It is plain data, and not an effect.

A raw call holds Value
fn undefined
to the address, or undefined for a deployment
data the bytes, "0x" when none was given
value the value, 0n when none was given
args []

The address called. Without it the call is a deployment: its data is the creation code of a contract.

The calldata, as it is sent.

  • Type: bigint
  • Default: 0n

The ether the call carries, in wei.

  • Nothing is checked and nothing is sent. The bytes are kept as you gave them.
  • A raw call is not read with Call.read. It is not a call of a view. For an eth_call of raw bytes, use Eth.call.
  • A revert of a raw call is a plain Revert. It declares no error to decode it with.