Skip to main content

encodeParameters

Callable

  • encodeParameters(abi: readonly AbiInput[], params: unknown[]): string

  • Encodes a parameter based on its type to its ABI representation.

    @example
    const res = web3.eth.abi.encodeParameters(
    ["uint256", "string"],
    ["2345675643", "Hello!%"]
    );

    console.log(res);
    > 0x000000000000000000000000000000000000000000000000000000008bd02b7b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000748656c6c6f212500000000000000000000000000000000000000000000000000

    Parameters

    Returns string

    • The ABI encoded parameters