Skip to content

Commit

Permalink
resolve merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kyscott18 committed Nov 9, 2023
2 parents 4e79945 + f77f99a commit 18587b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 67 deletions.
33 changes: 11 additions & 22 deletions packages/core/src/indexing/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { http } from "viem";
import { beforeEach, expect, test, vi } from "vitest";

import { usdcContractConfig } from "@/_test/constants";
import { setupIndexingStore, setupSyncStore } from "@/_test/setup";
import { setupIndexingStore } from "@/_test/setup";
import type { IndexingFunctions } from "@/build/functions";
import { LogEventMetadata } from "@/config/abi";
import { Source } from "@/config/sources";
Expand All @@ -11,7 +11,6 @@ import { SyncGateway } from "@/sync-gateway/service";

import { IndexingService } from "./service";

beforeEach((context) => setupSyncStore(context));
beforeEach((context) => setupIndexingStore(context));

const config = {
Expand Down Expand Up @@ -125,11 +124,10 @@ beforeEach(() => {
});

test("processEvents() calls getEvents with sequential timestamp ranges", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand Down Expand Up @@ -164,11 +162,10 @@ test("processEvents() calls getEvents with sequential timestamp ranges", async (
});

test("processEvents() calls indexing functions with correct arguments", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand Down Expand Up @@ -201,11 +198,10 @@ test("processEvents() calls indexing functions with correct arguments", async (c
});

test("processEvents() model methods insert data into the indexing store", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand All @@ -226,11 +222,10 @@ test("processEvents() model methods insert data into the indexing store", async
});

test("processEvents() updates event count metrics", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand Down Expand Up @@ -268,11 +263,10 @@ test("processEvents() updates event count metrics", async (context) => {
});

test("reset() reloads the indexing store", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand Down Expand Up @@ -304,11 +298,10 @@ test("reset() reloads the indexing store", async (context) => {
});

test("handleReorg() updates ponder_handlers_latest_processed_timestamp metric", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand Down Expand Up @@ -336,11 +329,10 @@ test("handleReorg() updates ponder_handlers_latest_processed_timestamp metric",
});

test("handleReorg() reverts the indexing store", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand All @@ -362,11 +354,10 @@ test("handleReorg() reverts the indexing store", async (context) => {
});

test("handleReorg() does nothing if there is a user error", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand All @@ -392,11 +383,10 @@ test("handleReorg() does nothing if there is a user error", async (context) => {
});

test("handleReorg() processes the correct range of events after a reorg", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand Down Expand Up @@ -432,11 +422,10 @@ test("handleReorg() processes the correct range of events after a reorg", async
});

test("handleReorg() updates ponder_handlers_latest_processed_timestamp metric", async (context) => {
const { common, syncStore, indexingStore } = context;
const { common, indexingStore } = context;

const service = new IndexingService({
common,
syncStore,
indexingStore,
syncGatewayService,
sources,
Expand Down
54 changes: 9 additions & 45 deletions packages/core/src/types/ponder.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { AbiEvent, ParseAbi } from "abitype";
import { assertType, test } from "vitest";

import { bigint, bytes, createSchema, createTable, string } from "@/schema";

import { ExtractAddress, ExtractAllAddresses, PonderApp } from "./ponder";

type OneAbi = ParseAbi<
Expand Down Expand Up @@ -71,8 +69,8 @@ test("PonderApp intersecting event names", () => {

test("PonderApp multiple contracts", () => {
type p = PonderApp<
// ^?
{
// ^?
networks: any;
contracts: readonly [
{ name: "One"; filters: any; abi: OneAbi },
Expand All @@ -95,8 +93,8 @@ test("PonderApp multiple contracts", () => {
test("PonderApp event type"),
() => {
type p = PonderApp<
// ^?
{
// ^?
networks: any;
contracts: readonly [{ name: "One"; filters: any; abi: OneAbi }];
},
Expand All @@ -117,8 +115,8 @@ test("PonderApp event type"),

test("PonderApp context network type", () => {
type p = PonderApp<
// ^?
{
// ^?
networks: any;
contracts: readonly [
{
Expand All @@ -140,8 +138,8 @@ test("PonderApp context network type", () => {

test("PonderApp context client type", () => {
type p = PonderApp<
// ^?
{
// ^?
networks: any;
contracts: readonly [
{
Expand All @@ -163,17 +161,17 @@ test("PonderApp context client type", () => {

test("PonderApp context contracts type", () => {
type p = PonderApp<
// ^?
{
// ^?
networks: any;
contracts: readonly [
{
name: "One";
filters: [
{ name: "mainnet"; address: "0x1" },
{ name: "optimism"; address: "0x2" }
];
filters: [{ name: "mainnet"; address: "0x1" }, { name: "optimism" }];
abi: OneAbi;
address: "0x2";
startBlock: 1;
endBlock: 2;
}
];
},
Expand All @@ -186,37 +184,3 @@ test("PonderApp context contracts type", () => {
(({}) as p).on("One:Event1", ({ context: { contracts } }) => {});
// ^?
});

test("PonderApp context entity type", () => {
const schema = createSchema({
ExampleTable: createTable({
id: string(),
kevin: bytes(),
kyle: bigint(),
}),
});

type p = PonderApp<
{
// ^?
networks: any;
contracts: readonly [
{
name: "One";
filters: [
{ name: "mainnet"; address: "0x1" },
{ name: "optimism"; address: "0x4" }
];
abi: OneAbi;
}
];
},
typeof schema
>;

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(({}) as p).on("One:Event1", ({ context: { models } }) => {});
// ^?
});

0 comments on commit 18587b7

Please sign in to comment.