Fix imports & add command to pin Tornado IPFS cids with daemon

This commit is contained in:
Theo 2023-10-05 12:58:54 -07:00
parent 9d6c6144bf
commit c1401b4a6e
3 changed files with 7 additions and 4 deletions

2
.gitignore vendored

@ -11,3 +11,5 @@ package-lock.json
build build
repos repos
test.ts

@ -6,7 +6,8 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"start": "ts-node --esm src/index.ts", "start": "ts-node --esm src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1" "pin": "ts-node --esm scripts/pinIPFS.ts",
"test": "ts-node --esm test.ts"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

@ -1,6 +1,6 @@
import { ethers } from "ethers"; import { ethers } from "ethers";
import { cidV0ToV1Base32 } from "@ensdomains/content-hash"; import { cidV0ToV1Base32 } from "@ensdomains/content-hash";
import { simpleGit, SimpleGit, CleanOptions } from "simple-git"; import { simpleGit, SimpleGit } from "simple-git";
import "dotenv/config"; import "dotenv/config";
import path from "path"; import path from "path";
@ -10,7 +10,7 @@ import { Domains, IPFSCids, RepoName } from "./types.ts";
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL || "https://rpc.mevblocker.io"); const provider = new ethers.JsonRpcProvider(process.env.RPC_URL || "https://rpc.mevblocker.io");
const git: SimpleGit = simpleGit(); const git: SimpleGit = simpleGit();
async function getENSDomainContenthash(domain: string): Promise<string> { export async function getENSDomainContenthash(domain: string): Promise<string> {
const resolver = await provider.getResolver(domain); const resolver = await provider.getResolver(domain);
if (!resolver) throw new Error(`Resolver for domain ${domain} not found!`); if (!resolver) throw new Error(`Resolver for domain ${domain} not found!`);