From 31c1696330ef0e70cf8532e528b9c8d509edce4c Mon Sep 17 00:00:00 2001 From: Eugenio Paluello Date: Fri, 20 Sep 2024 17:36:35 +0200 Subject: [PATCH] fix: move config const to constants.ts --- indexer/src/constants.ts | 22 +++++++++++++++++++++- indexer/src/main.ts | 33 +-------------------------------- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/indexer/src/constants.ts b/indexer/src/constants.ts index 3443ce14e..dde52fb20 100644 --- a/indexer/src/constants.ts +++ b/indexer/src/constants.ts @@ -1,5 +1,5 @@ import { padString } from "./utils/hex.ts"; -import { hash } from "./deps.ts"; +import { Config, hash, NetworkOptions, SinkOptions } from "./deps.ts"; // Get Sink Type or returns "console" if the value is null or undefined export const SINK_TYPE: "console" | "mongo" = (() => { @@ -76,3 +76,23 @@ export const IGNORED_KEYS: bigint[] = [ BigInt(hash.getSelectorFromName("Approval")), BigInt(hash.getSelectorFromName("OwnershipTransferred")), ]; + +export const config: Config = { + streamUrl: STREAM_URL, + authToken: AUTH_TOKEN, + startingBlock: STARTING_BLOCK, + network: "starknet", + finality: "DATA_STATUS_PENDING", + filter: { + header: { weak: false }, + // Filters are unions + events: [ + { + keys: [TRANSACTION_EXECUTED], + }, + ], + transactions: [{ includeReverted: true }], + }, + sinkType: SINK_TYPE, + sinkOptions: SINK_OPTIONS, +}; diff --git a/indexer/src/main.ts b/indexer/src/main.ts index 997e7d22d..d01017c61 100644 --- a/indexer/src/main.ts +++ b/indexer/src/main.ts @@ -7,15 +7,7 @@ import { } from "./utils/filter.ts"; // Constants -import { - AUTH_TOKEN, - NULL_HASH, - SINK_OPTIONS, - SINK_TYPE, - STARTING_BLOCK, - STREAM_URL, - TRANSACTION_EXECUTED, -} from "./constants.ts"; +import { NULL_HASH } from "./constants.ts"; // Types import { @@ -34,12 +26,9 @@ import { Collection, StoreItem } from "./types/storeItem.ts"; // Starknet import { BlockHeader, - Config, EventWithTransaction, hexToBytes, JsonRpcTx, - NetworkOptions, - SinkOptions, TransactionWithReceipt, } from "./deps.ts"; // Eth @@ -50,26 +39,6 @@ import { ProcessedTransaction, } from "./types/interfaces.ts"; -export const config: Config = { - streamUrl: STREAM_URL, - authToken: AUTH_TOKEN, - startingBlock: STARTING_BLOCK, - network: "starknet", - finality: "DATA_STATUS_PENDING", - filter: { - header: { weak: false }, - // Filters are unions - events: [ - { - keys: [TRANSACTION_EXECUTED], - }, - ], - transactions: [{ includeReverted: true }], - }, - sinkType: SINK_TYPE, - sinkOptions: SINK_OPTIONS, -}; - export default async function transform({ header, events,