@apibara/starknet 2.1.0-beta.23 → 2.1.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/parser.cjs CHANGED
@@ -37,7 +37,7 @@ function parseU256(data, offset) {
37
37
  function parseAsHex(data, offset) {
38
38
  assertInBounds(data, offset);
39
39
  return {
40
- out: String(data[offset]),
40
+ out: data[offset],
41
41
  offset: offset + 1
42
42
  };
43
43
  }
@@ -53,7 +53,7 @@ function parseFelt252(data, offset) {
53
53
  offset: offset + 1
54
54
  };
55
55
  }
56
- function parseEmpty(data, offset) {
56
+ function parseEmpty(_data, offset) {
57
57
  return { out: null, offset };
58
58
  }
59
59
  function parseArray(type) {
@@ -84,16 +84,17 @@ function parseStruct(parsers) {
84
84
  const sortedParsers = Object.entries(parsers).sort(
85
85
  (a, b) => a[1].index - b[1].index
86
86
  );
87
- return (data, startingOffset) => {
87
+ const parser = (data, startingOffset) => {
88
88
  let offset = startingOffset;
89
89
  const out = {};
90
- for (const [key, { parser }] of sortedParsers) {
91
- const { out: value, offset: newOffset } = parser(data, offset);
90
+ for (const [key, { parser: parser2 }] of sortedParsers) {
91
+ const { out: value, offset: newOffset } = parser2(data, offset);
92
92
  out[key] = value;
93
93
  offset = newOffset;
94
94
  }
95
95
  return { out, offset };
96
96
  };
97
+ return parser;
97
98
  }
98
99
  function parseTuple(...parsers) {
99
100
  return (data, startingOffset) => {
package/dist/parser.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { F as FieldElement } from './shared/starknet.2b19268a.cjs';
2
- import '@effect/schema/AST';
3
- import '@effect/schema';
1
+ import { a as FieldElement } from './shared/starknet.e649ecb1.cjs';
2
+ import '@apibara/protocol/codec';
3
+ import 'protobufjs/minimal.js';
4
4
 
5
5
  type Parser<TOut> = (data: readonly FieldElement[], offset: number) => {
6
6
  out: TOut;
@@ -28,7 +28,7 @@ declare function parseU256(data: readonly FieldElement[], offset: number): {
28
28
  offset: number;
29
29
  };
30
30
  declare function parseAsHex(data: readonly FieldElement[], offset: number): {
31
- out: string;
31
+ out: `0x${string}`;
32
32
  offset: number;
33
33
  };
34
34
  declare const parseContractAddress: typeof parseAsHex;
@@ -40,7 +40,7 @@ declare function parseFelt252(data: readonly FieldElement[], offset: number): {
40
40
  out: bigint;
41
41
  offset: number;
42
42
  };
43
- declare function parseEmpty(data: readonly FieldElement[], offset: number): {
43
+ declare function parseEmpty(_data: readonly FieldElement[], offset: number): {
44
44
  out: null;
45
45
  offset: number;
46
46
  };
@@ -53,17 +53,14 @@ declare function parseOption<T>(type: Parser<T>): (data: readonly FieldElement[]
53
53
  out: null;
54
54
  offset: number;
55
55
  };
56
- declare function parseStruct<T extends {
57
- [key: string]: unknown;
58
- }>(parsers: {
56
+ declare function parseStruct<T extends Record<string, unknown>>(parsers: {
59
57
  [K in keyof T]: {
60
58
  index: number;
61
59
  parser: Parser<T[K]>;
62
60
  };
63
- }): (data: readonly FieldElement[], startingOffset: number) => {
64
- out: Record<string, unknown>;
65
- offset: number;
66
- };
61
+ }): Parser<{
62
+ [K in keyof T]: T[K];
63
+ }>;
67
64
  declare function parseTuple<T extends Parser<unknown>[]>(...parsers: T): Parser<UnwrapParsers<T>>;
68
65
  type UnwrapParsers<TP> = {
69
66
  [Index in keyof TP]: TP[Index] extends Parser<infer U> ? U : never;
package/dist/parser.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { F as FieldElement } from './shared/starknet.2b19268a.mjs';
2
- import '@effect/schema/AST';
3
- import '@effect/schema';
1
+ import { a as FieldElement } from './shared/starknet.e649ecb1.mjs';
2
+ import '@apibara/protocol/codec';
3
+ import 'protobufjs/minimal.js';
4
4
 
5
5
  type Parser<TOut> = (data: readonly FieldElement[], offset: number) => {
6
6
  out: TOut;
@@ -28,7 +28,7 @@ declare function parseU256(data: readonly FieldElement[], offset: number): {
28
28
  offset: number;
29
29
  };
30
30
  declare function parseAsHex(data: readonly FieldElement[], offset: number): {
31
- out: string;
31
+ out: `0x${string}`;
32
32
  offset: number;
33
33
  };
34
34
  declare const parseContractAddress: typeof parseAsHex;
@@ -40,7 +40,7 @@ declare function parseFelt252(data: readonly FieldElement[], offset: number): {
40
40
  out: bigint;
41
41
  offset: number;
42
42
  };
43
- declare function parseEmpty(data: readonly FieldElement[], offset: number): {
43
+ declare function parseEmpty(_data: readonly FieldElement[], offset: number): {
44
44
  out: null;
45
45
  offset: number;
46
46
  };
@@ -53,17 +53,14 @@ declare function parseOption<T>(type: Parser<T>): (data: readonly FieldElement[]
53
53
  out: null;
54
54
  offset: number;
55
55
  };
56
- declare function parseStruct<T extends {
57
- [key: string]: unknown;
58
- }>(parsers: {
56
+ declare function parseStruct<T extends Record<string, unknown>>(parsers: {
59
57
  [K in keyof T]: {
60
58
  index: number;
61
59
  parser: Parser<T[K]>;
62
60
  };
63
- }): (data: readonly FieldElement[], startingOffset: number) => {
64
- out: Record<string, unknown>;
65
- offset: number;
66
- };
61
+ }): Parser<{
62
+ [K in keyof T]: T[K];
63
+ }>;
67
64
  declare function parseTuple<T extends Parser<unknown>[]>(...parsers: T): Parser<UnwrapParsers<T>>;
68
65
  type UnwrapParsers<TP> = {
69
66
  [Index in keyof TP]: TP[Index] extends Parser<infer U> ? U : never;
package/dist/parser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { F as FieldElement } from './shared/starknet.2b19268a.js';
2
- import '@effect/schema/AST';
3
- import '@effect/schema';
1
+ import { a as FieldElement } from './shared/starknet.e649ecb1.js';
2
+ import '@apibara/protocol/codec';
3
+ import 'protobufjs/minimal.js';
4
4
 
5
5
  type Parser<TOut> = (data: readonly FieldElement[], offset: number) => {
6
6
  out: TOut;
@@ -28,7 +28,7 @@ declare function parseU256(data: readonly FieldElement[], offset: number): {
28
28
  offset: number;
29
29
  };
30
30
  declare function parseAsHex(data: readonly FieldElement[], offset: number): {
31
- out: string;
31
+ out: `0x${string}`;
32
32
  offset: number;
33
33
  };
34
34
  declare const parseContractAddress: typeof parseAsHex;
@@ -40,7 +40,7 @@ declare function parseFelt252(data: readonly FieldElement[], offset: number): {
40
40
  out: bigint;
41
41
  offset: number;
42
42
  };
43
- declare function parseEmpty(data: readonly FieldElement[], offset: number): {
43
+ declare function parseEmpty(_data: readonly FieldElement[], offset: number): {
44
44
  out: null;
45
45
  offset: number;
46
46
  };
@@ -53,17 +53,14 @@ declare function parseOption<T>(type: Parser<T>): (data: readonly FieldElement[]
53
53
  out: null;
54
54
  offset: number;
55
55
  };
56
- declare function parseStruct<T extends {
57
- [key: string]: unknown;
58
- }>(parsers: {
56
+ declare function parseStruct<T extends Record<string, unknown>>(parsers: {
59
57
  [K in keyof T]: {
60
58
  index: number;
61
59
  parser: Parser<T[K]>;
62
60
  };
63
- }): (data: readonly FieldElement[], startingOffset: number) => {
64
- out: Record<string, unknown>;
65
- offset: number;
66
- };
61
+ }): Parser<{
62
+ [K in keyof T]: T[K];
63
+ }>;
67
64
  declare function parseTuple<T extends Parser<unknown>[]>(...parsers: T): Parser<UnwrapParsers<T>>;
68
65
  type UnwrapParsers<TP> = {
69
66
  [Index in keyof TP]: TP[Index] extends Parser<infer U> ? U : never;
package/dist/parser.mjs CHANGED
@@ -35,7 +35,7 @@ function parseU256(data, offset) {
35
35
  function parseAsHex(data, offset) {
36
36
  assertInBounds(data, offset);
37
37
  return {
38
- out: String(data[offset]),
38
+ out: data[offset],
39
39
  offset: offset + 1
40
40
  };
41
41
  }
@@ -51,7 +51,7 @@ function parseFelt252(data, offset) {
51
51
  offset: offset + 1
52
52
  };
53
53
  }
54
- function parseEmpty(data, offset) {
54
+ function parseEmpty(_data, offset) {
55
55
  return { out: null, offset };
56
56
  }
57
57
  function parseArray(type) {
@@ -82,16 +82,17 @@ function parseStruct(parsers) {
82
82
  const sortedParsers = Object.entries(parsers).sort(
83
83
  (a, b) => a[1].index - b[1].index
84
84
  );
85
- return (data, startingOffset) => {
85
+ const parser = (data, startingOffset) => {
86
86
  let offset = startingOffset;
87
87
  const out = {};
88
- for (const [key, { parser }] of sortedParsers) {
89
- const { out: value, offset: newOffset } = parser(data, offset);
88
+ for (const [key, { parser: parser2 }] of sortedParsers) {
89
+ const { out: value, offset: newOffset } = parser2(data, offset);
90
90
  out[key] = value;
91
91
  offset = newOffset;
92
92
  }
93
93
  return { out, offset };
94
94
  };
95
+ return parser;
95
96
  }
96
97
  function parseTuple(...parsers) {
97
98
  return (data, startingOffset) => {
@@ -0,0 +1,40 @@
1
+ import { Codec, CodecType } from '@apibara/protocol/codec';
2
+ import _m0 from 'protobufjs/minimal.js';
3
+
4
+ declare const protobufPackage = "starknet.v2";
5
+ /** A field element. */
6
+ interface FieldElement$1 {
7
+ readonly x0?: bigint | undefined;
8
+ readonly x1?: bigint | undefined;
9
+ readonly x2?: bigint | undefined;
10
+ readonly x3?: bigint | undefined;
11
+ }
12
+ declare const FieldElement$1: {
13
+ encode(message: FieldElement$1, writer?: _m0.Writer): _m0.Writer;
14
+ decode(input: _m0.Reader | Uint8Array, length?: number): FieldElement$1;
15
+ fromJSON(object: any): FieldElement$1;
16
+ toJSON(message: FieldElement$1): unknown;
17
+ create(base?: DeepPartial<FieldElement$1>): FieldElement$1;
18
+ fromPartial(object: DeepPartial<FieldElement$1>): FieldElement$1;
19
+ };
20
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
21
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
22
+ readonly $case: string;
23
+ } ? {
24
+ [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
25
+ } & {
26
+ readonly $case: T["$case"];
27
+ } : T extends {} ? {
28
+ [K in keyof T]?: DeepPartial<T[K]>;
29
+ } : Partial<T>;
30
+
31
+ type common_DeepPartial<T> = DeepPartial<T>;
32
+ declare const common_protobufPackage: typeof protobufPackage;
33
+ declare namespace common {
34
+ export { type common_DeepPartial as DeepPartial, FieldElement$1 as FieldElement, common_protobufPackage as protobufPackage };
35
+ }
36
+
37
+ declare const FieldElement: Codec<`0x${string}`, FieldElement$1>;
38
+ type FieldElement = CodecType<typeof FieldElement>;
39
+
40
+ export { FieldElement$1 as F, FieldElement as a, common as c };
@@ -0,0 +1,40 @@
1
+ import { Codec, CodecType } from '@apibara/protocol/codec';
2
+ import _m0 from 'protobufjs/minimal.js';
3
+
4
+ declare const protobufPackage = "starknet.v2";
5
+ /** A field element. */
6
+ interface FieldElement$1 {
7
+ readonly x0?: bigint | undefined;
8
+ readonly x1?: bigint | undefined;
9
+ readonly x2?: bigint | undefined;
10
+ readonly x3?: bigint | undefined;
11
+ }
12
+ declare const FieldElement$1: {
13
+ encode(message: FieldElement$1, writer?: _m0.Writer): _m0.Writer;
14
+ decode(input: _m0.Reader | Uint8Array, length?: number): FieldElement$1;
15
+ fromJSON(object: any): FieldElement$1;
16
+ toJSON(message: FieldElement$1): unknown;
17
+ create(base?: DeepPartial<FieldElement$1>): FieldElement$1;
18
+ fromPartial(object: DeepPartial<FieldElement$1>): FieldElement$1;
19
+ };
20
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
21
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
22
+ readonly $case: string;
23
+ } ? {
24
+ [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
25
+ } & {
26
+ readonly $case: T["$case"];
27
+ } : T extends {} ? {
28
+ [K in keyof T]?: DeepPartial<T[K]>;
29
+ } : Partial<T>;
30
+
31
+ type common_DeepPartial<T> = DeepPartial<T>;
32
+ declare const common_protobufPackage: typeof protobufPackage;
33
+ declare namespace common {
34
+ export { type common_DeepPartial as DeepPartial, FieldElement$1 as FieldElement, common_protobufPackage as protobufPackage };
35
+ }
36
+
37
+ declare const FieldElement: Codec<`0x${string}`, FieldElement$1>;
38
+ type FieldElement = CodecType<typeof FieldElement>;
39
+
40
+ export { FieldElement$1 as F, FieldElement as a, common as c };
@@ -0,0 +1,40 @@
1
+ import { Codec, CodecType } from '@apibara/protocol/codec';
2
+ import _m0 from 'protobufjs/minimal.js';
3
+
4
+ declare const protobufPackage = "starknet.v2";
5
+ /** A field element. */
6
+ interface FieldElement$1 {
7
+ readonly x0?: bigint | undefined;
8
+ readonly x1?: bigint | undefined;
9
+ readonly x2?: bigint | undefined;
10
+ readonly x3?: bigint | undefined;
11
+ }
12
+ declare const FieldElement$1: {
13
+ encode(message: FieldElement$1, writer?: _m0.Writer): _m0.Writer;
14
+ decode(input: _m0.Reader | Uint8Array, length?: number): FieldElement$1;
15
+ fromJSON(object: any): FieldElement$1;
16
+ toJSON(message: FieldElement$1): unknown;
17
+ create(base?: DeepPartial<FieldElement$1>): FieldElement$1;
18
+ fromPartial(object: DeepPartial<FieldElement$1>): FieldElement$1;
19
+ };
20
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
21
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
22
+ readonly $case: string;
23
+ } ? {
24
+ [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
25
+ } & {
26
+ readonly $case: T["$case"];
27
+ } : T extends {} ? {
28
+ [K in keyof T]?: DeepPartial<T[K]>;
29
+ } : Partial<T>;
30
+
31
+ type common_DeepPartial<T> = DeepPartial<T>;
32
+ declare const common_protobufPackage: typeof protobufPackage;
33
+ declare namespace common {
34
+ export { type common_DeepPartial as DeepPartial, FieldElement$1 as FieldElement, common_protobufPackage as protobufPackage };
35
+ }
36
+
37
+ declare const FieldElement: Codec<`0x${string}`, FieldElement$1>;
38
+ type FieldElement = CodecType<typeof FieldElement>;
39
+
40
+ export { FieldElement$1 as F, FieldElement as a, common as c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apibara/starknet",
3
- "version": "2.1.0-beta.23",
3
+ "version": "2.1.0-beta.25",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -27,8 +27,8 @@
27
27
  "build": "pnpm build:proto && unbuild",
28
28
  "build:proto": "buf generate proto",
29
29
  "typecheck": "tsc --noEmit",
30
- "test": "vitest",
31
- "test:ci": "vitest run",
30
+ "test": "vitest --typecheck",
31
+ "test:ci": "vitest run --typecheck",
32
32
  "lint": "biome check .",
33
33
  "lint:fix": "pnpm lint --write",
34
34
  "format": "biome format . --write"
@@ -42,8 +42,7 @@
42
42
  "vitest": "^1.6.0"
43
43
  },
44
44
  "dependencies": {
45
- "@apibara/protocol": "2.1.0-beta.23",
46
- "@effect/schema": "^0.67.15",
45
+ "@apibara/protocol": "2.1.0-beta.25",
47
46
  "@scure/starknet": "^1.1.0",
48
47
  "abi-wan-kanabi": "^2.2.4",
49
48
  "effect": "^3.2.6",
@@ -0,0 +1,140 @@
1
+ /*
2
+
3
+ This file extends "abi-wan-kanabi" to provide a more type-safe way to decode events.
4
+
5
+ https://github.com/keep-starknet-strange/abi-wan-kanabi
6
+
7
+ This is free and unencumbered software released into the public domain.
8
+ Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
9
+ In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
10
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
+ For more information, please refer to https://unlicense.org
12
+
13
+ */
14
+
15
+ import type { Abi } from "abi-wan-kanabi";
16
+ import type {
17
+ AbiEventMember,
18
+ ExtractAbiEvent,
19
+ ExtractAbiEventNames,
20
+ StringToPrimitiveType,
21
+ } from "abi-wan-kanabi/kanabi";
22
+
23
+ export type AbiEventStruct = {
24
+ type: "event";
25
+ name: string;
26
+ kind: "struct";
27
+ members: AbiEventMember[];
28
+ };
29
+
30
+ export type AbiMember = {
31
+ name: string;
32
+ type: string;
33
+ };
34
+
35
+ export type AbiEventEnum = {
36
+ type: "event";
37
+ name: string;
38
+ kind: "enum";
39
+ variants: AbiEventMember[];
40
+ };
41
+
42
+ export type AbiEvent = AbiEventStruct | AbiEventEnum;
43
+
44
+ export type AbiItem = Abi[number];
45
+
46
+ export type DecodeEventArgs<
47
+ TAbi extends Abi = Abi,
48
+ TEventName extends ExtractAbiEventNames<TAbi> = ExtractAbiEventNames<TAbi>,
49
+ TStrict extends boolean = true,
50
+ > = {
51
+ abi: TAbi;
52
+ eventName: TEventName;
53
+ event: Event;
54
+ strict?: TStrict;
55
+ };
56
+
57
+ export type DecodedEvent<
58
+ TAbi extends Abi = Abi,
59
+ TEventName extends ExtractAbiEventNames<TAbi> = ExtractAbiEventNames<TAbi>,
60
+ > = Event & {
61
+ eventName: TEventName;
62
+ args: EventToPrimitiveType<TAbi, TEventName>;
63
+ };
64
+
65
+ export type DecodeEventReturn<
66
+ TAbi extends Abi = Abi,
67
+ TEventName extends ExtractAbiEventNames<TAbi> = ExtractAbiEventNames<TAbi>,
68
+ TStrict extends boolean = true,
69
+ > = TStrict extends true
70
+ ? DecodedEvent<TAbi, TEventName>
71
+ : DecodedEvent<TAbi, TEventName> | null;
72
+
73
+ // Helper type to resolve the payload type of a nested variant.
74
+ // when the type name corresponds to an event; resolves it using EventToPrimitiveType,
75
+ export type ResolveNestedVariantType<
76
+ TAbi extends Abi,
77
+ TTypeName extends string,
78
+ > = EventToPrimitiveType<TAbi, TTypeName>; // resolve its structure recursively
79
+
80
+ // Helper type to convert a variant member (nested or flat) into its corresponding tagged union part(s).
81
+ export type VariantToTaggedUnion<
82
+ TAbi extends Abi,
83
+ TVariant extends AbiEventMember,
84
+ > = TVariant extends { kind: "nested" }
85
+ ? // Nested: Use the helper to resolve the payload type.
86
+ { _tag: TVariant["name"] } & {
87
+ [K in TVariant["name"]]: ResolveNestedVariantType<TAbi, TVariant["type"]>;
88
+ }
89
+ : TVariant extends { kind: "flat" }
90
+ ? // Flat: Recursively call EventToPrimitiveType on the referenced event type.
91
+ // This will return the union of tagged types for the nested event.
92
+ EventToPrimitiveType<TAbi, TVariant["type"]>
93
+ : never; // Should not happen for valid ABIs
94
+
95
+ // Main type to convert an event definition (struct or enum) to its TS representation.
96
+ export type EventToPrimitiveType<
97
+ TAbi extends Abi,
98
+ TEventName extends ExtractAbiEventNames<TAbi>,
99
+ > = ExtractAbiEvent<TAbi, TEventName> extends infer TEventDef
100
+ ? TEventDef extends {
101
+ type: "event";
102
+ kind: "struct";
103
+ members: infer TMembers extends readonly AbiEventMember[];
104
+ }
105
+ ? // Struct Event: A simple object with member names as keys and their primitive types as values.
106
+ {
107
+ [Member in TMembers[number] as Member["name"]]: StringToPrimitiveType<
108
+ TAbi,
109
+ Member["type"]
110
+ >;
111
+ }
112
+ : TEventDef extends {
113
+ type: "event";
114
+ kind: "enum";
115
+ variants: infer TVariants extends readonly AbiEventMember[];
116
+ }
117
+ ? // Enum Event: Create a union of all possible tagged types derived from its variants.
118
+ {
119
+ // Map each variant to its corresponding tagged union structure(s).
120
+ [Idx in keyof TVariants]: VariantToTaggedUnion<TAbi, TVariants[Idx]>;
121
+ }[number] // Indexing with [number] converts the tuple of union parts into a single union type.
122
+ : // Explicitly handle empty enum events to ensure the `extends never` check works reliably.
123
+ TEventDef extends { type: "event"; kind: "enum"; variants: [] }
124
+ ? never
125
+ : // Not an event definition found for TEventName -> never
126
+ never
127
+ : // If the event name is not found in the ABI, return never.
128
+ never;
129
+
130
+ export function isEventAbi(item: AbiItem): item is AbiEvent {
131
+ return item.type === "event";
132
+ }
133
+
134
+ export function isStructEventAbi(item: AbiItem): item is AbiEventStruct {
135
+ return isEventAbi(item) && item.kind === "struct";
136
+ }
137
+
138
+ export function isEnumEventAbi(item: AbiItem): item is AbiEventEnum {
139
+ return isEventAbi(item) && item.kind === "enum";
140
+ }