Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Explicitly add the chain Id to the JSONRPCPROVIDER #62

Merged
merged 2 commits into from
Nov 18, 2021
Merged
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions packages/use-contractkit/src/ethers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { useContractKit } from './use-contractkit';
import { useIsMounted } from './utils/useIsMounted';

export const useProvider = (): Web3Provider => {
const { kit } = useContractKit();
const { kit, network } = useContractKit();
const provider = kit.web3.currentProvider as unknown as ExternalProvider;
return useMemo(() => {
return new Web3Provider(provider);
return new Web3Provider(provider, {chainId: network.chainId, name: network.name});
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good but like linter says you'll need to update the memo list too

Copy link
Member Author

Choose a reason for hiding this comment

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

yep.

Copy link
Member Author

Choose a reason for hiding this comment

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

was wondering about your thoughts on moving the provider up into the App Context Provider. Or maybe its own ProviderProvider Context? so

Copy link
Contributor

Choose a reason for hiding this comment

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

Your comment cuts out. What would be the benefit of the move?

Copy link
Member Author

Choose a reason for hiding this comment

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

One shared instance rather than each component that uses this having its own

}, [provider]);
};

Expand Down