Documentation for eth_defi.token.fetch_erc20_details function.
- fetch_erc20_details(web3, token_address, max_str_length=256, raise_on_error=True)
Read token details from on-chain data.
Connect to Web3 node and do RPC calls to extract the token info. We apply some sanitazation for incoming data, like length checks and removal of null bytes.
The function should not raise an exception as long as the underlying node connection does not fail.
details = fetch_erc20_details(web3, token_address) assert details.name == "Hentai books token" assert details.decimals == 6
Sanitised token info
- Return type