https://github.com/chainsafe/web3-context
A React context implementation of Onboard.js & general utilities
https://github.com/chainsafe/web3-context
Last synced: 4 months ago
JSON representation
A React context implementation of Onboard.js & general utilities
- Host: GitHub
- URL: https://github.com/chainsafe/web3-context
- Owner: ChainSafe
- License: lgpl-3.0
- Created: 2020-08-06T11:41:58.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-09-15T13:36:25.000Z (over 2 years ago)
- Last Synced: 2025-10-10T00:47:00.712Z (4 months ago)
- Language: TypeScript
- Size: 411 KB
- Stars: 14
- Watchers: 5
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Web3-Context
A React Context wrapper for Blocknative OnbardJS
## How to use
Wrap you application in a
```
{YOUR APP CODE}
```
The following props can be passed in to configure the Web3 Provider:
```
onboardConfig?: OnboardConfig; // The OnboardJS Configuration object - See [here](https://docs.blocknative.com/onboard#built-in-modules)
networkIds?: number[]; // Defaults to 1 if nothing is provided
ethGasStationApiKey?: string;
gasPricePollingInterval?: number; //Seconds between gas price polls. Defaults to 0 - Disabled
gasPriceSetting?: EthGasStationSettings | EtherchainGasSettings;
tokensToWatch?: TokensToWatch; // Network-keyed collection of token addresses to watch
spenderAddress?: string;
cacheWalletSelection?: boolean;
checkNetwork?: boolean; // Defaults to true if networkIds are provided
children: React.ReactNode;
```
Anywhere further down the component tree, use:
```
const {address} = useWeb3();
```
Take a look at the `example` folder for a basic implementation of the components.
### Happy Building ♡