A React Context wrapper for Blocknative OnbardJS with a couple of utility functions
npm install @chainsafe/web3-contextA React Context wrapper for Blocknative OnbardJS
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
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.