dataUtils: {
    decodeBytes32String: ((hex: string) => string);
    encodeBytes32String: ((value: string, zeroPadding??: "left" | "right") => string);
} = ...

Type declaration

  • decodeBytes32String: ((hex: string) => string)
      • (hex): string
      • Decodes a hexadecimal string representing a bytes32 value into a string. The bytes32 string can be padded with zeros to the left or right. An example of usage is to decode a bytes32 string returned by a smart contract function.

        Parameters

        • hex: string

          The hexadecimal string to decode.

        Returns string

        • The decoded string value.
  • encodeBytes32String: ((value: string, zeroPadding??: "left" | "right") => string)
      • (value, zeroPadding?): string
      • Encodes a string into a bytes32 hexadecimal expression with optional zero padding. The encoded bytes32 string can be used as a parameter for a smart contract function.

        Parameters

        • value: string

          The value to encode.

        • OptionalzeroPadding: "left" | "right" = 'right'

          The type of zero padding to apply.

        Returns string

        The encoded bytes32 string is a hexadecimal expression prefixed with `0x.