You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just installed the latest version of Uniswap Python and it fails here:
fromuniswapimportUniswapfromweb3importWeb3address=None# or None if you're not going to make transactionsprivate_key=None# or None if you're not going to make transactionsversion=2# specify which version of Uniswap to usebsc="https://bsc-dataseed.binance.org/"web3=Web3(Web3.HTTPProvider(bsc))
print(web3.isConnected())
uniswap=Uniswap(address=address, private_key=private_key, version=version, web3=web3)
The web3 connection return true but I keep getting this error:
Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/XX/XX/UniSwap_API_test.py", line 24, in <module>
uniswap = Uniswap(address=address, private_key=private_key, version=version, web3=web3)
File "C:\Users\User\PycharmProjects\XX\venv\lib\site-packages\uniswap\uniswap.py", line 121, in __init__
router_contract_addr = _router_contract_addresses_v2[self.network]
KeyError: 'binance'
_factory_contract_addresses_v2 and _router_contract_addresses_v2 accordingly
I suppose you gonna use pancakeswap v2 so addresses are
0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73 for factoryV2
0x10ED43C718714eb63d5aA57B78B54704E256024E for routerV2
Activity
liquid-8 commentedon Jun 28, 2021
That's a bug definitely.
You need to add BSC factory/router contracts addresses here
uniswap-python/uniswap/constants.py
Line 25 in 0400e51
_factory_contract_addresses_v2 and _router_contract_addresses_v2 accordingly
I suppose you gonna use pancakeswap v2 so addresses are
0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73 for factoryV2
0x10ED43C718714eb63d5aA57B78B54704E256024E for routerV2
LucaZanatta commentedon Jun 29, 2021
I added the 2 lines in the dictionary, but I still have the same error.
This is the dictionary. Is it true?
liquid-8 commentedon Jun 30, 2021
No, it should be
and next dictionary
ErikBjare commentedon Jul 2, 2021
Fixed in #129