The object of this library is to decode & encode the transaction input sent to the Uniswap universal router (UR) (address 0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B on Ethereum Mainnet). It is based on, and is intended to be used with web3.py
⚠ At this stage, there is no guarantee of compatibility between 2 versions: consider forcing the version in your dependency requirements.
It's also possible to decode the whole transaction, given its hash and providing the codec has been built with either a valid Web3 instance or the link to a rpc endpoint:
The UR allows the chaining of several functions in the same transaction. This codec supports it (at least for supported functions) and exposes public methods that can be chained.
The chaining starts with the encode.chain() method and ends with the build() one which return the full encoded data to be included in the transaction. Below some examples of encoded input for one function and one example for 2 functions.
Default values for deadlines and expirations can be computed with the static methods get_default_deadline() and get_default_expiration() respectively.