Created
September 11, 2022 08:05
-
-
Save aeither/0add4a5e7550b04706d7241a71583ddd to your computer and use it in GitHub Desktop.
This file contains 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
import { ethers } from "ethers"; | |
import * as dotenv from "dotenv"; | |
dotenv.config(); | |
async function main() { | |
const API_KEY = process.env.API_KEY; | |
if (!API_KEY) { | |
console.log("No api key"); | |
return; | |
} | |
const list = [ | |
]; | |
const provider = new ethers.providers.AlchemyProvider("rinkeby"); | |
let contractAddresses = [""]; | |
list.map(async (address) => { | |
const isCode = await provider.getCode(address); | |
const val = isCode.length > 2 ? address : "No Contract"; | |
console.log("val", val); | |
if (val == "No Contract") { | |
contractAddresses.push(address); | |
} | |
}); | |
console.log("contractAddresses", contractAddresses); | |
} | |
main() | |
.then(async () => {}) | |
.catch(async (e) => { | |
console.error(e); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment