Blockchain integration
This library help interacting with EVM chains in a React environment, it contains some reducers, slices, and hooks that could be helpful in any DApps
Configuration
This library requires some default environment variables
NEXT_PUBLIC_NETWORK_IDS="[1, 3, 42]"
1, 3 and 42 are respectively mainnet, ropsten and kovan, the 3 networks supported by this library.
If you have 3 networks you need to specify their RPC url.
NEXT_PUBLIC_MAINNET_URL="https://eth-mainnet.alchemyapi.io/v2/API_KEY"
NEXT_PUBLIC_KOVAN_URL="https://eth-kovan.alchemyapi.io/v2/API_KEY"
NEXT_PUBLIC_ROPSTEN_URL="https://eth-ropsten.alchemyapi.io/v2/API_KEY"
Hooks
-
useBlockNumber
provide information for the current block number
-
useDebounce
Used by this library, provide a debounce functionality
-
usePendingTransactions
Give all pending transactions for the logged in account
-
useSyncProvider
Sync the application with the provider choosen and update the current block by listening to the provider
-
useTransactionManager
Watch all transaction being made and update on their status by calling notifications and updating the app state
-
useTransactions
Return all transactions history
Slices
Slices are isolated redux state part that need to be passed in to the reducer field in configureStore @redux/toolkit functions
-
appSettingsSlice
all actions and state required for wallet and confirmation modals
-
blockChainSlice
all actions and state required for the blockchain ID, blockNumber and blockTimestamp
-
notificationsSlice
all actions and state required for notifications
-
transactionsSlice
all actions and state required for managing transactions status and history