Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NamedEventInput type #58

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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
>;

5 changes: 2 additions & 3 deletions packages/evm-client/src/contract/utils/objectToArray.ts
Original file line number Diff line number Diff line change
@@ -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,
@@ -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 });


Unchanged files with check annotations Beta

/**
* Retrieves the value associated with the specified key.
*/
get: (key: TKey) => TValue | undefined;

Check warning on line 21 in packages/evm-client/src/cache/types/SimpleCache.ts

GitHub Actions / verify (lint)

'key' is defined but never used
/**
* Associates the specified value with the specified key in the cache. If the
* cache previously contained a mapping for the key, the old value is
* replaced.
*/
set: (key: TKey, value: TValue) => void;

Check warning on line 28 in packages/evm-client/src/cache/types/SimpleCache.ts

GitHub Actions / verify (lint)

'key' is defined but never used

Check warning on line 28 in packages/evm-client/src/cache/types/SimpleCache.ts

GitHub Actions / verify (lint)

'value' is defined but never used
/**
* Removes the mapping for the specified key from this cache if present.
*/
delete: (key: TKey) => void;

Check warning on line 33 in packages/evm-client/src/cache/types/SimpleCache.ts

GitHub Actions / verify (lint)

'key' is defined but never used
/**
* Removes all of the mappings from this cache.
* @param predicate - A function to test each key-value pair in the cache.
*/
find: (
predicate: (value: TValue, key: TKey) => boolean,

Check warning on line 47 in packages/evm-client/src/cache/types/SimpleCache.ts

GitHub Actions / verify (lint)

'predicate' is defined but never used

Check warning on line 47 in packages/evm-client/src/cache/types/SimpleCache.ts

GitHub Actions / verify (lint)

'value' is defined but never used

Check warning on line 47 in packages/evm-client/src/cache/types/SimpleCache.ts

GitHub Actions / verify (lint)

'key' is defined but never used
) => TValue | undefined;
}
decodeFunctionData<
TFunctionName extends FunctionName<TAbi> = FunctionName<TAbi>,
>(
...args: ContractDecodeFunctionDataArgs

Check warning on line 230 in packages/evm-client/src/contract/stubs/ReadContractStub.ts

GitHub Actions / verify (lint)

'args' is defined but never used
): DecodedFunctionData<TAbi, TFunctionName> {
throw new Error('Method not implemented.');
}
encodeFunctionData<
TFunctionName extends FunctionName<TAbi> = FunctionName<TAbi>,
>(
...args: ContractEncodeFunctionDataArgs<TAbi, TFunctionName>

Check warning on line 239 in packages/evm-client/src/contract/stubs/ReadContractStub.ts

GitHub Actions / verify (lint)

'args' is defined but never used
): `0x${string}` {
throw new Error('Method not implemented.');
}
namespace?: string;
clearCache(): void;
deleteRead<TFunctionName extends FunctionName<TAbi>>(
...[functionName, args, options]: ContractReadArgs<TAbi, TFunctionName>

Check warning on line 16 in packages/evm-client/src/contract/types/CachedContract.ts

GitHub Actions / verify (lint)

'functionName' is defined but never used
): void;
}