tradingstrategy-ai / web3-ethereum-defi

A Python library for trading automation on DeFi, data research and integration. Supporting Uniswap, Aave, Chainlink, USDC and other protocols.
https://tradingstrategy.ai
MIT License
611 stars 131 forks source link

New uniswap subgraph endpoints #214

Closed AlexShashkov closed 2 months ago

AlexShashkov commented 4 months ago

Uniswap suddenly shut down their graphql public apis. At the moment, the most recent version returns this error when using get_pool_state_at_block from eth_defi.uniswap_v3.liquidity for any chain

gql.transport.exceptions.TransportServerError: 410 Client Error: Gone for url: https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3

Now uniswap supports only decentralized subgraphs, which require user token to work, for example:

subgraph_endpoints = {
    "Ethereum" : f"https://gateway-arbitrum.network.thegraph.com/api/{os.environ.get('SUBGRAPH_SECRET', '123456')}/subgraphs/id/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV",
    "Arbitrum" : f"https://gateway-arbitrum.network.thegraph.com/api/{os.environ.get('SUBGRAPH_SECRET', '123456')}/subgraphs/id/FbCGRftH4a3yZugY7TnbYgPJVEv2LvMT6oF1fxPe9aJM",
    "Optimism" : f"https://gateway-arbitrum.network.thegraph.com/api/{os.environ.get('SUBGRAPH_SECRET', '123456')}/subgraphs/id/Cghf4LfVqPiFw6fp6Y5X5Ubc8UpmUhSfJL82zwiBFLaj",
    "Base"     : f"https://gateway-arbitrum.network.thegraph.com/api/{os.environ.get('SUBGRAPH_SECRET', '123456')}/subgraphs/id/3RGpVwLywy5nNV17BPRC3QvGZPwKXQFQLsSK6Txr2jzi"
}
AlexShashkov commented 4 months ago

https://github.com/tradingstrategy-ai/web3-ethereum-defi/pull/215 One of the possible fixes