generated from scaffold-eth/scaffold-eth-2
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d0bea5
commit e0556e7
Showing
12 changed files
with
706 additions
and
33 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
"workspaces": { | ||
"packages": [ | ||
"packages/hardhat", | ||
"packages/nextjs" | ||
"packages/nextjs", | ||
"packages/local_db" | ||
] | ||
}, | ||
"scripts": { | ||
|
@@ -28,7 +29,8 @@ | |
"postinstall": "husky install", | ||
"precommit": "lint-staged", | ||
"vercel": "yarn workspace @se-2/nextjs vercel", | ||
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo" | ||
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo", | ||
"seed": "yarn workspace @se-2/local_db seed" | ||
}, | ||
"packageManager": "[email protected]", | ||
"devDependencies": { | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# dependencies | ||
/node_modules | ||
|
||
# build | ||
/dist | ||
|
||
# misc | ||
.DS_Store | ||
|
||
# local env files | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
# seed | ||
seed.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { applicationDefault, getApps, initializeApp } from "firebase-admin/app"; | ||
import { getFirestore } from "firebase-admin/firestore"; | ||
|
||
const getFirestoreConnector = () => { | ||
if (getApps().length > 0) { | ||
return getFirestore(); | ||
} | ||
|
||
if (process.env.GOOGLE_APPLICATION_CREDENTIALS) { | ||
console.log("Initializing LIVE Firestore"); | ||
initializeApp({ | ||
credential: applicationDefault(), | ||
}); | ||
} else { | ||
console.log("Initializing local Firestore instance"); | ||
initializeApp({ | ||
projectId: process.env.FIREBASE_PROJECT_ID, | ||
}); | ||
} | ||
|
||
return getFirestore(); | ||
}; | ||
|
||
export { getFirestoreConnector }; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as dotenv from "dotenv"; | ||
dotenv.config({ path: "../nextjs/.env.local" }); | ||
|
||
import { getFirestoreConnector } from "./firestoreDB.js"; | ||
import { importSeed } from "./utils.js"; | ||
|
||
const seedData = async () => { | ||
const firestoreDB = getFirestoreConnector(); | ||
|
||
const args = process.argv.slice(2); | ||
const flags = args.filter((arg) => arg.startsWith("--")); | ||
const isForceProd = flags.includes("--force-prod"); | ||
|
||
if (process.env.GOOGLE_APPLICATION_CREDENTIALS) { | ||
console.log("Connected to LIVE Firestore"); | ||
if (!isForceProd) { | ||
console.log("To update Live firestore use `yarn seed --force-prod`"); | ||
console.log("Exiting..."); | ||
return; | ||
} | ||
} | ||
|
||
try { | ||
await importSeed(firestoreDB); | ||
} catch (error) { | ||
console.error("Error seeding the data:", error); | ||
} | ||
}; | ||
|
||
try { | ||
seedData(); | ||
} catch (error) { | ||
console.error("Error initializing seed data:", error); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@se-2/local_db", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"seed": "tsx index.ts" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"dotenv": "^16.4.1", | ||
"firebase-admin": "^11.11.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.11.16", | ||
"tsx": "^4.7.0", | ||
"typescript": "^5.3.3" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
{ | ||
"version": "1.1.1", | ||
"users": { | ||
"0x60583563D5879C2E59973E5718c7DE2147971807": { | ||
"creationTimestamp": 1633088553221, | ||
"role": "admin", | ||
"ens": "carletex.eth", | ||
"function": "damageDealer", | ||
"status": { | ||
"text": "My Status", | ||
"timestamp": 1657208443047 | ||
}, | ||
"builderCohort": [ | ||
{ | ||
"id": "0x2eA63c9C9C114ae85b1027697A906420a23e8572", | ||
"name": "Sand Garden", | ||
"url": "https://sandgarden.buidlguidl.com" | ||
} | ||
], | ||
"stream": { | ||
"streamAddress": "0xCC756617C97a05aC472fD8Ab92C88F2A9cb681EC", | ||
"streamAddress_rinkeby": "0xCC756617C97a05aC472fD8Ab92C88F2A9cb681EC", | ||
"streamAddress_localhost": "0x5FbDB2315678afecb367f032d93F642f64180aa3", | ||
"cap": "0.5", | ||
"frequency": 2592000, | ||
"lastContract": 1654720543, | ||
"lastIndexedBlock": 10983432, | ||
"balance": "0.21" | ||
}, | ||
"builds": [ | ||
{ | ||
"id": "06bb3c9d-784b-44d1-b7e2-1ae5affdfa8b", | ||
"submittedTimestamp": 1658587661752 | ||
} | ||
] | ||
}, | ||
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8": { | ||
"creationTimestamp": 1633088553223, | ||
"role": "builder", | ||
"function": "damageDealer", | ||
"socialLinks": { | ||
"telegram": "test", | ||
"twitter": "test" | ||
}, | ||
"builderCohort": [ | ||
{ | ||
"id": "0x2eA63c9C9C114ae85b1027697A906420a23e8572", | ||
"name": "Sand Garden", | ||
"url": "https://sandgarden.buidlguidl.com" | ||
}, | ||
{ | ||
"id": "0xaCc9Cc4983D57cea0748B8CD1Adb87Ada5b1a67c", | ||
"name": "Not Just Notfellows", | ||
"url": "https://not-just-notfellows.buidlguidl.com/" | ||
} | ||
], | ||
"stream": { | ||
"streamAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3", | ||
"cap": "0.5", | ||
"frequency": 2592000, | ||
"lastContract": 1654720543, | ||
"lastIndexedBlock": 10983432, | ||
"balance": "0.5" | ||
} | ||
}, | ||
"0x34aA3F359A9D614239015126635CE7732c18fDF3": { | ||
"creationTimestamp": 1648653481405, | ||
"role": "builder", | ||
"function": "knight", | ||
"ens": "austingriffith.eth" | ||
}, | ||
"0x72fC8b63692B516D0D8748d469faB65C7e4e7389": { | ||
"creationTimestamp": 1648653501156, | ||
"role": "builder", | ||
"function": "cadets", | ||
"ensClaimData": { | ||
"submittedTimestamp": 1648736241913, | ||
"provided": true | ||
} | ||
} | ||
}, | ||
"builds": { | ||
"06bb3c9d-784b-44d1-b7e2-1ae5affdfa8b": { | ||
"branch": "https://github.com/moonshotcollective/scaffold-directory", | ||
"demoUrl": "https://speedrunethereum.com/", | ||
"videoUrl": "", | ||
"desc": "👩🏫 Learn how to build on Ethereum completing the scaffold-eth challenges.", | ||
"image": "https://storage.googleapis.com/download/storage/v1/b/buidlguidl-v3.appspot.com/o/builds%2F0032da28a08871cbcb2922b00.png?generation=1647284971917513&alt=media", | ||
"name": "🏃♀️ SpeedRunEthereum.com", | ||
"builder": "0x60583563D5879C2E59973E5718c7DE2147971807", | ||
"featured": false, | ||
"submittedTimestamp": 1658587661752, | ||
"likes": ["0x60583563D5879C2E59973E5718c7DE2147971807"] | ||
} | ||
}, | ||
"events": [ | ||
{ | ||
"type": "build.submit", | ||
"timestamp": 1658587661754, | ||
"signature": "0x206e5f766fb427599acacb41d45dfb794d95076f3af8519008328cef9c6bf3b4137a87ba73368f1e16b19674edddb6860093e601e6576c1b427fcc8e7ffba4cb1b", | ||
"payload": { | ||
"userAddress": "0x60583563D5879C2E59973E5718c7DE2147971807", | ||
"buildUrl": "https://github.com/moonshotcollective/scaffold-directory", | ||
"name": "🏃♀️ SpeedRunEthereum.com", | ||
"buildId": "06bb3c9d-784b-44d1-b7e2-1ae5affdfa8b" | ||
} | ||
}, | ||
{ | ||
"type": "stream.withdraw", | ||
"timestamp": 1660983774000, | ||
"payload": { | ||
"userAddress": "0x60583563D5879C2E59973E5718c7DE2147971807", | ||
"amount": "0.5", | ||
"block": "13845820", | ||
"reason": "Test withdraw", | ||
"streamAddress": "0xCC756617C97a05aC472fD8Ab92C88F2A9cb681EC", | ||
"tx": "0x6be7d0065eb1ec0f5e9296b82b527e4b1b8fec91d890066d43857044443a9969" | ||
} | ||
} | ||
], | ||
"cohorts": { | ||
"0x2eA63c9C9C114ae85b1027697A906420a23e8572": { | ||
"chainId": 10, | ||
"name": "Sand Garden", | ||
"url": "https://sandgarden.buidlguidl.com" | ||
}, | ||
"0x2Be18e07C7be0a2CC408C9E02C90203B2052D7DE": { | ||
"chainId": 1, | ||
"name": "Jessy's Hacker House", | ||
"url": "https://hackerhouse.buidlguidl.com/" | ||
} | ||
}, | ||
"config": { | ||
"streams": { | ||
"lastIndexedBlock": 10616289 | ||
} | ||
}, | ||
"notifications": [ | ||
{ | ||
"criteria": { | ||
"minBuilds": 1, | ||
"daysJoinedBefore": 30, | ||
"hasStream": true | ||
}, | ||
"title": "New cohort coming", | ||
"content": "Some 'New cohort coming' **markdown** content with [links](https://buidlguidl.com)", | ||
"active": true | ||
}, | ||
{ | ||
"criteria": { | ||
"daysJoinedAfter": 2 | ||
}, | ||
"title": "Onboarding Batch!", | ||
"content": "Some 'Onboarding Batch' **markdown** content with [links](https://buidlguidl.com)", | ||
"active": true | ||
}, | ||
{ | ||
"criteria": { | ||
"hasStream": true | ||
}, | ||
"component": "OnboardingBatch", | ||
"active": true | ||
}, | ||
{ | ||
"criteria": { | ||
"hasStream": true | ||
}, | ||
"title": "Announment for stremead builders", | ||
"content": "Some 'Announment for stremead builders' **markdown** content with [links](https://buidlguidl.com)", | ||
"active": false | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"noUncheckedIndexedAccess": true, | ||
"skipLibCheck": true, | ||
"target": "es2022", | ||
"allowJs": true, | ||
"resolveJsonModule": true, | ||
"moduleDetection": "force", | ||
"isolatedModules": true, | ||
"moduleResolution": "NodeNext", | ||
"esModuleInterop": true, | ||
"module": "NodeNext", | ||
"outDir": "dist", | ||
"exclude": ["node_modules", "dist"] | ||
} | ||
} |
Oops, something went wrong.