25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
// @ts-ignore
|
|
import contentHash from "content-hash";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
|
|
import { DeclCalculator } from "./utils";
|
|
import { classicUiIpfsCid, novaUiIpfsCid, relayersUiIpfsCid, docsIpfsCid } from "./constants";
|
|
|
|
const contentHashToBytesMemory = (hash: string) => `hex"${hash}"`;
|
|
|
|
const classicUiIPFSContenthash = contentHash.fromIpfs(classicUiIpfsCid);
|
|
const novaUiIPFSContenthash = contentHash.fromIpfs(novaUiIpfsCid);
|
|
const relayersUiIPFSContenthash = contentHash.fromIpfs(relayersUiIpfsCid);
|
|
const docsIPFSContenthash = contentHash.fromIpfs(docsIpfsCid);
|
|
|
|
const solidityDoublePadding = " ".repeat(8);
|
|
const { calculateDecl } = new DeclCalculator("bytes memory", solidityDoublePadding, contentHashToBytesMemory);
|
|
const solidityCode =
|
|
calculateDecl({ classicUiIPFSContenthash }) +
|
|
calculateDecl({ novaUiIPFSContenthash }) +
|
|
calculateDecl({ relayersUiIPFSContenthash }) +
|
|
calculateDecl({ docsIPFSContenthash });
|
|
|
|
fs.writeFileSync(path.join("data", "ensDomainsIPFSContenthashes.txt"), solidityCode);
|