forked from software-mansion-labs/GoL2
-
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.
Merge pull request #12 from yuki-wtf/add-whitelist-scripts
Add whitelist generation script
- Loading branch information
Showing
6 changed files
with
44 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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import fs from "fs"; | ||
import { AppDataSource } from "./db"; | ||
|
||
export const generateWhitelistMintGenerations = async () => { | ||
const infinite = await AppDataSource.query(` | ||
SELECT "transactionOwner", "gameGeneration", "gameState", "createdAt" | ||
FROM "public"."infinite" | ||
WHERE "transactionType" = 'game_evolved' | ||
ORDER BY "gameGeneration" ASC | ||
`); | ||
|
||
// @ts-ignore | ||
const processedData = infinite.reduce((acc, row) => { | ||
acc[row.gameGeneration] = { | ||
user_id: row.transactionOwner, | ||
game_state: row.gameState, | ||
timestamp: Math.floor(row.createdAt.getTime() / 1000), // Convert to Unix seconds | ||
}; | ||
return acc; | ||
}, {}); | ||
|
||
// Convert to JSON string with pretty formatting | ||
const jsonData = JSON.stringify(processedData, null, 2); | ||
|
||
// Write to a file | ||
fs.writeFile("gol2-whitelist.json", jsonData, (err) => { | ||
if (err) { | ||
console.error("Error writing file:", err); | ||
return; | ||
} | ||
console.log("Successfully wrote to gol2-whitelist.json"); | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
10 changes: 6 additions & 4 deletions
10
indexer/src/whitelistGenerator.ts → .../utils/saveWhitelistProofsFromFileToDB.ts
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