encode

Encodes a transaction object into a hexadecimal string representation of the encoded data.

Example

import { encode } from "thirdweb";
const encodedData = await encode(transaction);
function encode(
transaction: PreparedTransaction<abi, abiFn>,
): Promise<Hex>;

Parameters

The transaction object to encode.

Type

let transaction: PreparedTransaction<abi, abiFn>;

Returns

let returnType: `0x${string}`;

A promise that resolves to the encoded data as a hexadecimal string.