Skip to content

Instantly share code, notes, and snippets.

@JoviDeCroock
Created January 20, 2022 09:29
Show Gist options
  • Save JoviDeCroock/e9d16d7b6e1269083d9cdf925806658c to your computer and use it in GitHub Desktop.
Save JoviDeCroock/e9d16d7b6e1269083d9cdf925806658c to your computer and use it in GitHub Desktop.
export class BaseClient {
connect() {} // some types
}
export class EthereumClient extends BaseClient {
connect() {
// connects with ethers
}
}
const Web3Context = React.createContext<BaseClient>();
export const Web3Provider = ({ children, client: BaseClient }) => {
return <Web3Context.Provider value={client}>{children}
}
export const useWallet = () => {
// get context
// connect wallet
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment