The types to encode.
The values to encode.
Optional
tight: booleanWhether to pack the values tightly. When enabled, bytesN
values in arrays will be packed without any padding. This matches the
behaviour of ethereumjs-abi
. Defaults to false
.
Encode the data with the provided types. The types must be valid Solidity ABI types. This is similar to encode, but the values are encoded in the non-standard packed mode. This differs from the standard encoding in the following ways:
uint16
values are still padded to 2 bytes, regardless of the length of the value.bytes
,string
) is different. The length of the dynamic type is not included in the encoding, and the dynamic type is not padded to a multiple of 32 bytes.The encoding of this is ambiguous as soon as there is more than one dynamic type. That means that these values cannot be decoded with decode or Solidity's
abi.decode
function.See encode for more information on how values are parsed.
Example
See
Returns
The ABI encoded bytes.