Decode transaction sent to Uniswap universal router
Project description
Uniswap Universal Router Decoder
Description
The object of this library is to decode the transaction input sent to the Uniswap universal router
(address 0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B
on Ethereum Mainnet).
⚠ Not all commands are decoded yet. Below a list of the commands that have already been implemented.
Command Id | Function Name | Is Implemented |
---|---|---|
0x08 | V2_SWAP_EXACT_IN | ✅ |
0x0a | PERMIT2_PERMIT | ✅ |
Usage
The library exposes a class, RouterDecoder
with 2 public methods decode_function_input
and decode_transaction
.
To decode a transaction input:
from uniswap_universal_router_decoder.router_decoder import RouterDecoder
trx_input = "0x3593564c000000000000000000 ... 90095b5c4e9f5845bba" # the trx input to decode
decoder = RouterDecoder()
decoded_trx_input = decoder.decode_transaction(trx_input)
It's also possible to decode the whole transaction, given its hash and providing the decoder has been built with either a valid Web3 instance or the link to a rpc endpoint:
# Using a web3 instance
from web3 import Web3
from uniswap_universal_router_decoder.router_decoder import RouterDecoder
w3 = Web3(...) # your web3 instance
decoder = RouterDecoder(w3=w3)
# Using a rpc endpoint
from web3 import Web3
from uniswap_universal_router_decoder.router_decoder import RouterDecoder
rpc_link = "https://..." # your rpc enpoint
decoder = RouterDecoder(rpc_endpoint=rpc_link)
And then the decoder will get the transaction from the blockchain and decode it, along with its input data:
# Using a rpc endpoint
trx_hash = "0x52e63b7 ... 11b979dd9"
decoded_transaction = decoder.decode_transaction(trx_hash)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for uniswap-universal-router-decoder-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bff995a41b56b9b89d6a75e8de044d4782e179edae7757cb711af8d35985117 |
|
MD5 | 7bae0efb704cb545d3742e33a5ca56e2 |
|
BLAKE2b-256 | 66c533545874dfb15a83f230e4e5749c4918d51feda7060c2b9dbc765cc4ffe7 |
Hashes for uniswap_universal_router_decoder-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 770628882dbf96b61b1f78277951c079eaa42a685331225a4ef85bb91b9e735d |
|
MD5 | 09d987ec3b3f71a5e1bad781d4fd859b |
|
BLAKE2b-256 | 925575864bdf1c85910fd71ff646b5c249250caaf15b1f7ca0b13d72ab561fd5 |