Skip to content

Commit

Permalink
feat: store ipfs data in db
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Sep 6, 2024
1 parent 3807d4c commit 3f8257d
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 36 deletions.
8 changes: 8 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type CoingeckoSupportedChainId =
| 1088;

const CHAIN_DATA_VERSION = "81";
const IPFS_DATA_VERSION = "1";

export type Token = {
code: string;
Expand Down Expand Up @@ -1829,6 +1830,8 @@ export type Config = {
readOnlyDatabaseUrl: string;
dataVersion: string;
databaseSchemaName: string;
ipfsDataVersion: string;
ipfsDatabaseSchemaName: string;
hostname: string;
pinoPretty: boolean;
deploymentEnvironment: "local" | "development" | "staging" | "production";
Expand Down Expand Up @@ -1989,6 +1992,9 @@ export function getConfig(): Config {
const dataVersion = CHAIN_DATA_VERSION;
const databaseSchemaName = `chain_data_${dataVersion}`;

const ipfsDataVersion = IPFS_DATA_VERSION;
const ipfsDatabaseSchemaName = `ipfs_data_${ipfsDataVersion}`;

const dropDb = z.boolean().default(false).parse(args["drop-db"]);

const removeCache = z.boolean().default(false).parse(args["rm-cache"]);
Expand Down Expand Up @@ -2041,6 +2047,8 @@ export function getConfig(): Config {
removeCache,
dataVersion,
databaseSchemaName,
ipfsDataVersion,
ipfsDatabaseSchemaName,
httpServerWaitForSync,
httpServerEnabled,
indexerEnabled,
Expand Down
5 changes: 5 additions & 0 deletions src/database/changeset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
NewPrice,
NewLegacyProject,
NewApplicationPayout,
NewIpfsData,
} from "./schema.js";

export type DataChange =
Expand Down Expand Up @@ -140,4 +141,8 @@ export type DataChange =
| {
type: "InsertApplicationPayout";
payout: NewApplicationPayout;
}
| {
type: "InsertIpfsData";
ipfs: NewIpfsData;
};
Loading

0 comments on commit 3f8257d

Please sign in to comment.