Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ describe('convertEip1193RequestToJsonRpcRequest', () => {
id: 'mock-id',
jsonrpc: '2.0',
method: 'test',
params: {},
});
});
});
25 changes: 13 additions & 12 deletions packages/eth-json-rpc-provider/src/safe-event-emitter-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ export function convertEip1193RequestToJsonRpcRequest<
>(
eip1193Request: Eip1193Request<Params>,
): JsonRpcRequest<Params | Record<never, never>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this return type is invalid. The Record<never, never> does not belong here, no possible return value is represented by that type. Yet if we remove it, we get the type error I referenced in the other thread. How odd.

Maybe we can fix it in a later PR, since it's a pre-existing issue. This type is used later in this file as well.

const {
id = uuidV4(),
jsonrpc = '2.0',
method,
params = {},
} = eip1193Request;
return {
id,
jsonrpc,
method,
params,
};
const { id = uuidV4(), jsonrpc = '2.0', method, params } = eip1193Request;
return params
? {
id,
jsonrpc,
method,
params,
}
: {
id,
jsonrpc,
method,
};
}

/**
Expand Down