Encodes the python values in ``args`` as a sequence of binary values of the ABI types in ``types`` via the head-tail mechanism. :param types: An iterable of string representations of the ABI types that will be used for encoding e.g. ``('uint256', 'bytes[]',
(self, types: Iterable[TypeStr], args: Iterable[Any])
| 75 | return encoder(arg) |
| 76 | |
| 77 | def encode_abi(self, types: Iterable[TypeStr], args: Iterable[Any]) -> bytes: |
| 78 | """ |
| 79 | Encodes the python values in ``args`` as a sequence of binary values of |
| 80 | the ABI types in ``types`` via the head-tail mechanism. |
| 81 | |
| 82 | :param types: An iterable of string representations of the ABI types |
| 83 | that will be used for encoding e.g. ``('uint256', 'bytes[]', |
| 84 | '(int,int)')`` |
| 85 | :param args: An iterable of python values to be encoded. |
| 86 | |
| 87 | :returns: The head-tail encoded binary representation of the python |
| 88 | values in ``args`` as values of the ABI types in ``types``. |
| 89 | """ |
| 90 | warnings.warn( |
| 91 | "abi.encode_abi() and abi.encode_abi_packed() are deprecated and will be " |
| 92 | "removed in version 4.0.0 in favor of abi.encode() and " |
| 93 | "abi.encode_packed(), respectively", |
| 94 | category=DeprecationWarning, |
| 95 | ) |
| 96 | return self.encode(types, args) |
| 97 | |
| 98 | def encode(self, types, args): |
| 99 | encoders = [self._registry.get_encoder(type_str) for type_str in types] |