Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENS to Hex Address #2

Open
MadDog250 opened this issue Jun 9, 2022 · 0 comments
Open

ENS to Hex Address #2

MadDog250 opened this issue Jun 9, 2022 · 0 comments

Comments

@MadDog250
Copy link
Contributor

Need help converting ENS names to their Hexadecimal addresses. This code take csv files of addresses and converts to JSON object. Need it to check for ENS name and convert if true. See https://github.com/The-Funding-Cooperative-DAO/Merkle-Airdrop-Site/blob/master/generator/src/csv.js for details.

`const fs = require('fs');
const path = require('path');
const readline = require('readline');

async function exportObj() {

let content = {};
let a = {};
const fileStream = fs.createReadStream('./src/airdrop.csv');
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity
});

let index = 0;
for await (const line of rl) {
const splits = line.split(",");
let num = Number(splits[1])
a[splits[0]] = num;
index++;
}

content.airdrop = a;
const result = JSON.stringify(content);
console.log(result)
fs.writeFileSync("../generator/new-config.json", result);
}

exportObj();`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant