From 8608ba8666a35c76e2ff24bd1a831f03b9e0b7c4 Mon Sep 17 00:00:00 2001 From: Tony Stark Date: Sat, 9 Dec 2023 13:49:28 -0600 Subject: [PATCH] fix: formatted --- packages/indexer/src/starknet/parser.test.ts | 29 ++++++++++---------- packages/indexer/src/starknet/parser.ts | 3 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/indexer/src/starknet/parser.test.ts b/packages/indexer/src/starknet/parser.test.ts index 85bd80a..68ece09 100644 --- a/packages/indexer/src/starknet/parser.test.ts +++ b/packages/indexer/src/starknet/parser.test.ts @@ -1,34 +1,33 @@ -import { Contract } from './parser'; -import { describe, expect, it } from "vitest" +import { Contract } from "./parser"; +import { describe, expect, it } from "vitest"; import { FieldElement } from "./felt"; import { EventAbi } from "starknet"; -describe('Contract class tests', () => { - const mockContractAddress: FieldElement = '0x0'; +describe("Contract class tests", () => { + const mockContractAddress: FieldElement = "0x0"; const mockEventAbi: EventAbi = { - type: 'event', - name: 'MockEvent', - kind: 'struct', - members: [{ name: 'param1', type: 'felt', kind: 'key' }], + type: "event", + name: "MockEvent", + kind: "struct", + members: [{ name: "param1", type: "felt", kind: "key" }], }; const mockContractAbi = [mockEventAbi]; - it('should create an EventFilter for a valid event name', () => { + it("should create an EventFilter for a valid event name", () => { const contract = new Contract(mockContractAddress, mockContractAbi); - const filter = contract.eventFilter('MockEvent'); + const filter = contract.eventFilter("MockEvent"); expect(filter).toBeDefined(); expect(filter.fromAddress).toBe(mockContractAddress); // Further assertions can be made based on the expected structure of EventFilter }); - it('should throw an error for an invalid event name', () => { + it("should throw an error for an invalid event name", () => { const contract = new Contract(mockContractAddress, mockContractAbi); expect(() => { - contract.eventFilter('InvalidEvent'); - }).toThrow('Event InvalidEvent not found in contract ABI'); + contract.eventFilter("InvalidEvent"); + }).toThrow("Event InvalidEvent not found in contract ABI"); }); - -}); \ No newline at end of file +}); diff --git a/packages/indexer/src/starknet/parser.ts b/packages/indexer/src/starknet/parser.ts index 9f8ba43..d702dc2 100644 --- a/packages/indexer/src/starknet/parser.ts +++ b/packages/indexer/src/starknet/parser.ts @@ -3,7 +3,6 @@ import { EventFilter } from "./filter"; import { type Abi, EventAbi, hash } from "starknet"; - // The Contract class implements the EventFilterParser interface. export class Contract { // Read-only properties for the contract's address and its ABI. @@ -19,7 +18,7 @@ export class Contract { private _findEvent(name: string): EventAbi | undefined { // Find the event in the ABI matching the provided name. const event: EventAbi | undefined = this.contractAbi.find( - (item) => item.type === "event" && item.name === name + (item) => item.type === "event" && item.name === name, ); return event;