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
567 stars 125 forks source link

New uniswap subgraph endpoints #214

Open AlexShashkov opened 3 weeks ago

AlexShashkov commented 3 weeks 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 3 weeks ago

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