-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.investigateUnder investigation and may be a bug.Under investigation and may be a bug.minor-bumpPlanned for the next minor version bump.Planned for the next minor version bump.v6Issues regarding v6Issues regarding v6
Description
Ethers Version
6.3.0
Search Terms
No response
Describe the Problem
Hey there, it's time for me to migrate from v5 to v6 and I have some problems, can you please help me to solve them?!
1 log types are incompatible
import { Interface, JsonRpcProvider, Log, LogDescription } from "ethers";
const provider = new JsonRpcProvider();
const logs: Log[] = await provider.send("eth_getLogs", [
{
address,
fromBlock,
toBlock,
topics,
},
]);
const iface = new Interface(ERC721abi);
for (const log of logs) {
const description = iface.parseLog(log); // <-- ERROR
}
TS2345: Argument of type 'Log' is not assignable to parameter of type '{ topics: string[]; data: string; }'.
Types of property 'topics' are incompatible.
The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type 'string[]'.
I guess the reason is
parseLog(log: { topics: Array<string>, data: string}): null | LogDescription {
that has to be
parseLog(log: Log): null | LogDescription {
jubalm and sgb-io
Metadata
Metadata
Assignees
Labels
fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.investigateUnder investigation and may be a bug.Under investigation and may be a bug.minor-bumpPlanned for the next minor version bump.Planned for the next minor version bump.v6Issues regarding v6Issues regarding v6