mirror of
https://github.com/Instadapp/boardroom-inc-protocol-Info.git
synced 2024-07-29 22:37:02 +00:00
fetch and write token addr and abit
This commit is contained in:
parent
11d363bf5c
commit
6f2dd66c31
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@ dist
|
|||
# Remove some common IDE working directories
|
||||
.idea
|
||||
.vscode
|
||||
.env
|
1
allprotocols.json
Normal file
1
allprotocols.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,5 @@
|
|||
import axios from "axios";
|
||||
import fs from "fs";
|
||||
|
||||
const SNAPSHOT_API = "https://hub.snapshot.page/api/";
|
||||
|
||||
|
@ -54,6 +55,14 @@ function extractTokenAddress(space: Space): string | null {
|
|||
}
|
||||
}
|
||||
|
||||
async function extractTokenAbi(tokenAddress: string) {
|
||||
const data = await axios.get(
|
||||
`https://api.etherscan.io/api?module=contract&action=getabi&address=${tokenAddress}&apikey=${process.env.ETHERSCAN_API_TOKEN}`,
|
||||
);
|
||||
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const allMainnetSpaces = await fetchMainnetSpaces();
|
||||
|
||||
|
@ -63,10 +72,13 @@ async function run() {
|
|||
|
||||
// console.log(Object.keys(withMembers).length);
|
||||
|
||||
fs.writeFileSync("./allprotocols.json", JSON.stringify(withMembers));
|
||||
|
||||
for (let i = 0; i < Object.keys(withMembers).length; i++) {
|
||||
const key = Object.keys(withMembers)[i];
|
||||
|
||||
const tokenAddress = extractTokenAddress(withMembers[key]);
|
||||
const tokenAbi = extractTokenAbi(tokenAddress);
|
||||
|
||||
console.log(tokenAddress);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user