Created
June 13, 2025 15:51
-
-
Save spirinvladimir/40f7653ff48c99f36c2bc45680b2d874 to your computer and use it in GitHub Desktop.
Get a pairs by pool addresses using Etherscan.io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make_url = a => `https://etherscan.io/address/${a}#notes` | |
a = new Set() | |
Object.keys(state.exchanges.uniswap_v3).forEach(t0 => { | |
Object.keys(state.exchanges.uniswap_v3[t0]).forEach(t1 => { | |
a.add(state.exchanges.uniswap_v3[t0][t1]) | |
}) | |
}) | |
state.exchanges.uniswap_v3 = {} | |
a = [...a] | |
total = a.length | |
a.reduce((chain, address, i) => | |
chain | |
.then(() => fetch(make_url(address))) | |
.then(_ => _.text()) | |
.then(s => { | |
var [_, A, B] = s.match(/exchange between (.+) and (.+)\./) | |
state.exchanges.uniswap_v3[A] ??= {} | |
state.exchanges.uniswap_v3[A][B] = address | |
state.exchanges.uniswap_v3[B] ??= {} | |
state.exchanges.uniswap_v3[B][A] = true | |
console.log(A,B, `${i}/${total}`) | |
}) | |
.then( | |
() => new Promise(ok => setTimeout(ok, 2000)) | |
), | |
Promise.resolve() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment