generated from defi-wonderland/ts-turborepo-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
21 changed files
with
323 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# grants-stack-indexer: processors package | ||
|
||
Description of your package goes here. | ||
|
||
## Setup | ||
|
||
1. Install dependencies running `pnpm install` | ||
|
||
## Available Scripts | ||
|
||
Available scripts that can be run using `pnpm`: | ||
|
||
| Script | Description | | ||
| ------------- | ------------------------------------------------------- | | ||
| `build` | Build library using tsc | | ||
| `check-types` | Check types issues using tsc | | ||
| `clean` | Remove `dist` folder | | ||
| `lint` | Run ESLint to check for coding standards | | ||
| `lint:fix` | Run linter and automatically fix code formatting issues | | ||
| `format` | Check code formatting and style using Prettier | | ||
| `format:fix` | Run formatter and automatically fix issues | | ||
| `test` | Run tests using vitest | | ||
| `test:cov` | Run tests with coverage report | | ||
|
||
## Usage | ||
|
||
Describe how to use your package here. | ||
|
||
## API | ||
|
||
Describe your package's API here. | ||
|
||
## References | ||
|
||
Add any relevant references here. |
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,37 @@ | ||
{ | ||
"name": "@grants-stack-indexer/processors", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "", | ||
"license": "MIT", | ||
"author": "Wonderland", | ||
"type": "module", | ||
"main": "./dist/src/index.js", | ||
"types": "./dist/src/index.d.ts", | ||
"directories": { | ||
"src": "src" | ||
}, | ||
"files": [ | ||
"dist/*", | ||
"package.json", | ||
"!**/*.tsbuildinfo" | ||
], | ||
"scripts": { | ||
"build": "tsc -p tsconfig.build.json", | ||
"check-types": "tsc --noEmit -p ./tsconfig.json", | ||
"clean": "rm -rf dist/", | ||
"format": "prettier --check \"{src,test}/**/*.{js,ts,json}\"", | ||
"format:fix": "prettier --write \"{src,test}/**/*.{js,ts,json}\"", | ||
"lint": "eslint \"{src,test}/**/*.{js,ts,json}\"", | ||
"lint:fix": "pnpm lint --fix", | ||
"test": "vitest run --config vitest.config.ts --passWithNoTests", | ||
"test:cov": "vitest run --config vitest.config.ts --coverage" | ||
}, | ||
"dependencies": { | ||
"@grants-stack-indexer/metadata": "workspace:*", | ||
"@grants-stack-indexer/pricing": "workspace:*", | ||
"@grants-stack-indexer/repository": "workspace:*", | ||
"@grants-stack-indexer/shared": "workspace:*", | ||
"viem": "2.21.19" | ||
} | ||
} |
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,11 @@ | ||
import { Changeset } from "@grants-stack-indexer/repository"; | ||
import { AlloEvent, ProtocolEvent } from "@grants-stack-indexer/shared"; | ||
|
||
import type { IProcessor } from "../internal.js"; | ||
|
||
export class AlloProcessor implements IProcessor<"Allo", AlloEvent> { | ||
//TODO: Implement | ||
process(_event: ProtocolEvent<"Allo", AlloEvent>): Promise<Changeset> { | ||
throw new Error("Method not implemented."); | ||
} | ||
} |
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 @@ | ||
export * from "./allo.processor.js"; |
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,3 @@ | ||
// Add your external exports here | ||
export { StrategyProcessor, AlloProcessor } from "./internal.js"; | ||
export type { IProcessor } from "./internal.js"; |
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 @@ | ||
export * from "./external.js"; |
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 @@ | ||
export * from "./processor.interface.js"; |
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,11 @@ | ||
import type { Changeset } from "@grants-stack-indexer/repository"; | ||
import { ContractName, ContractToEventName, ProtocolEvent } from "@grants-stack-indexer/shared"; | ||
|
||
export interface IProcessor<C extends ContractName, E extends ContractToEventName<C>> { | ||
/** | ||
* Processes an event from the Allo protocol. | ||
* @param event - The event to process. | ||
* @returns A promise that resolves to a changeset. | ||
*/ | ||
process(event: ProtocolEvent<C, E>): Promise<Changeset>; | ||
} |
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,4 @@ | ||
// Add your internal exports here | ||
export * from "./interfaces/index.js"; | ||
export * from "./allo/index.js"; | ||
export * from "./strategy/index.js"; |
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 @@ | ||
export * from "./strategy.processor.js"; |
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,11 @@ | ||
import { Changeset } from "@grants-stack-indexer/repository"; | ||
import { ProtocolEvent, StrategyEvent } from "@grants-stack-indexer/shared"; | ||
|
||
import type { IProcessor } from "../internal.js"; | ||
|
||
export class StrategyProcessor implements IProcessor<"Strategy", StrategyEvent> { | ||
process(_event: ProtocolEvent<"Strategy", StrategyEvent>): Promise<Changeset> { | ||
//TODO: Implement | ||
throw new Error("Method not implemented."); | ||
} | ||
} |
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,5 @@ | ||
import { describe, it } from "vitest"; | ||
|
||
describe("dummy", () => { | ||
it.skip("dummy", () => {}); | ||
}); |
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,11 @@ | ||
{ | ||
"extends": "../../tsconfig.build.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"declarationMap": true, | ||
"declaration": true, | ||
"outDir": "dist" | ||
}, | ||
"include": ["src/**/*"], | ||
"exclude": ["node_modules", "dist", "test"] | ||
} |
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,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["src/**/*"] | ||
} |
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 @@ | ||
import path from "path"; | ||
import { configDefaults, defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({ | ||
test: { | ||
globals: true, | ||
environment: "node", | ||
include: ["test/**/*.spec.ts"], | ||
exclude: ["node_modules", "dist"], | ||
coverage: { | ||
provider: "v8", | ||
reporter: ["text", "json", "html"], | ||
exclude: ["node_modules", "dist", "src/index.ts", ...configDefaults.exclude], | ||
}, | ||
}, | ||
resolve: { | ||
alias: { | ||
"@": path.resolve(__dirname, "src"), | ||
}, | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
export * from "./db/connection.js"; | ||
export * from "./repositories/kysely/index.js"; | ||
export * from "./interfaces/index.js"; | ||
export * from "./external.js"; |
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,142 @@ | ||
import type { Address, ChainId } from "@grants-stack-indexer/shared"; | ||
|
||
import { | ||
NewPendingProjectRole, | ||
NewProject, | ||
NewProjectRole, | ||
PartialProject, | ||
ProjectRole, | ||
} from "./project.types.js"; | ||
import { | ||
NewPendingRoundRole, | ||
NewRound, | ||
NewRoundRole, | ||
PartialRound, | ||
RoundRole, | ||
} from "./round.types.js"; | ||
|
||
export type Changeset = | ||
| { | ||
type: "InsertProject"; | ||
args: { | ||
project: NewProject; | ||
}; | ||
} | ||
| { | ||
type: "UpdateProject"; | ||
args: { | ||
chainId: ChainId; | ||
projectId: string; | ||
project: PartialProject; | ||
}; | ||
} | ||
| { | ||
type: "InsertPendingProjectRole"; | ||
args: { | ||
pendingProjectRole: NewPendingProjectRole; | ||
}; | ||
} | ||
| { | ||
type: "DeletePendingProjectRoles"; | ||
args: { | ||
ids: number[]; | ||
}; | ||
} | ||
| { | ||
type: "InsertProjectRole"; | ||
args: { | ||
projectRole: NewProjectRole; | ||
}; | ||
} | ||
| { | ||
type: "DeleteAllProjectRolesByRole"; | ||
args: { | ||
projectRole: Pick<ProjectRole, "chainId" | "projectId" | "role">; | ||
}; | ||
} | ||
| { | ||
type: "DeleteAllProjectRolesByRoleAndAddress"; | ||
args: { | ||
projectRole: Pick<ProjectRole, "chainId" | "projectId" | "role" | "address">; | ||
}; | ||
} | ||
| { | ||
type: "InsertRound"; | ||
args: { | ||
round: NewRound; | ||
}; | ||
} | ||
| { | ||
type: "UpdateRound"; | ||
args: { | ||
chainId: ChainId; | ||
roundId: string; | ||
round: PartialRound; | ||
}; | ||
} | ||
| { | ||
type: "UpdateRoundByStrategyAddress"; | ||
args: { | ||
chainId: ChainId; | ||
strategyAddress: Address; | ||
round: PartialRound; | ||
}; | ||
} | ||
| { | ||
type: "IncrementRoundFundedAmount"; | ||
args: { | ||
chainId: ChainId; | ||
roundId: string; | ||
fundedAmount: bigint; | ||
fundedAmountInUsd: number; | ||
}; | ||
} | ||
| { | ||
type: "IncrementRoundDonationStats"; | ||
args: { | ||
chainId: ChainId; | ||
roundId: Address; | ||
amountInUsd: number; | ||
}; | ||
} | ||
| { | ||
type: "IncrementRoundTotalDistributed"; | ||
args: { | ||
chainId: ChainId; | ||
roundId: string; | ||
amount: bigint; | ||
}; | ||
} | ||
| { | ||
type: "IncrementApplicationDonationStats"; | ||
args: { | ||
chainId: ChainId; | ||
roundId: Address; | ||
applicationId: string; | ||
amountInUsd: number; | ||
}; | ||
} | ||
| { | ||
type: "InsertPendingRoundRole"; | ||
args: { | ||
pendingRoundRole: NewPendingRoundRole; | ||
}; | ||
} | ||
| { | ||
type: "DeletePendingRoundRoles"; | ||
args: { | ||
ids: number[]; | ||
}; | ||
} | ||
| { | ||
type: "InsertRoundRole"; | ||
args: { | ||
roundRole: NewRoundRole; | ||
}; | ||
} | ||
| { | ||
type: "DeleteAllRoundRolesByRoleAndAddress"; | ||
args: { | ||
roundRole: Pick<RoundRole, "chainId" | "roundId" | "role" | "address">; | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./project.types.js"; | ||
export * from "./round.types.js"; | ||
export * from "./changeset.types.js"; |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export type { AnyProtocolEvent, Address, Branded, ChainId } from "./internal.js"; | ||
export type * from "./types/index.js"; | ||
export type { Address } from "./internal.js"; | ||
export { NATIVE_TOKEN_ADDRESS, isNativeToken } from "./constants/index.js"; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.