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:
Most values are packed tightly, without alignment padding.
The exception is array values, which are padded to 32 bytes.
Values are still padded to their full size, i.e., uint16 values are still
padded to 2 bytes, regardless of the length of the value.
The encoding of dynamic types (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.
All values are encoded in-place, without any offsets.
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.
Whether 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:
uint16values 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.decodefunction.See encode for more information on how values are parsed.
Example
See
Returns
The ABI encoded bytes.