Created
January 20, 2022 09:29
-
-
Save JoviDeCroock/e9d16d7b6e1269083d9cdf925806658c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class BaseClient { | |
connect() {} // some types | |
} | |
export class EthereumClient extends BaseClient { | |
connect() { | |
// connects with ethers | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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