Skip to content

Commit

Permalink
Fix NamedEventInput type (#58)
Browse files Browse the repository at this point in the history
* Fix `NamedEventInput` type

* Add changeset

* Parameterize `objectToArray` value type
  • Loading branch information
ryangoree authored Apr 3, 2024
1 parent ea691e8 commit 5c35487
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-hornets-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@delvtech/evm-client": patch
---

Fix error with `NamedEventInput` type which was broken and causing broken downstream types such as `EventFilter`
2 changes: 1 addition & 1 deletion packages/evm-client/src/contract/types/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type NamedEventInput<
TAbi extends Abi,
TEventName extends EventName<TAbi>,
> = Extract<
AbiParameters<TAbi, 'event', TEventName, 'inputs'>,
AbiParameters<TAbi, 'event', TEventName, 'inputs'>[number],
NamedAbiParameter
>;

Expand Down
5 changes: 2 additions & 3 deletions packages/evm-client/src/contract/utils/objectToArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function objectToArray<
TItemType extends AbiItemType,
TName extends AbiEntryName<TAbi, TItemType>,
TParameterKind extends AbiParameterKind,
TValue extends AbiObjectType<TAbi, TItemType, TName, TParameterKind>,
>({
abi,
type,
Expand All @@ -63,11 +64,9 @@ export function objectToArray<
}: {
abi: TAbi;
name: TName;
value?: Abi extends TAbi
? Record<string, unknown> // <- fallback for unknown ABI type
: Partial<AbiObjectType<TAbi, TItemType, TName, TParameterKind>>;
kind: TParameterKind;
type: TItemType;
value?: Abi extends TAbi ? Record<string, unknown> : TValue;
}): AbiArrayType<TAbi, TItemType, TName, TParameterKind> {
const abiEntry = getAbiEntry({ abi, type, name });

Expand Down

0 comments on commit 5c35487

Please sign in to comment.