Getting Started
Install @linagee/lnr-ethers-react as a dependency in your React project:
- npm
- yarn
npm install @linagee/lnr-ethers-react
yarn add @linagee/lnr-ethers-react
Note
You need at least react version 18.2.0 to use @linagee/lnr-ethers-react.
Set LnrConfigProvider as a wrapper for your app
Example:
import { AppProps } from 'next/app';
import { ethers } from 'ethers';
import { LnrConfigProvider } from '@linagee/lnr-ethers-react';
function MyApp({ Component, pageProps }: AppProps) {
const config = {
provider: new ethers.providers.AlchemyProvider(1, process.env.REACT_APP_ALCHEMY_API
),
};
return (
<LnrConfigProvider config={config}>
<Component {...pageProps} />
</LnrConfigProvider>
);
}
export default MyApp;
Note
You need to set REACT_APP_ALCHEMY_API in your .env file. You can set any provider you want, but we recommend using Alchemy.