blockchain-integration
v0.0.15
Published
Library to help integrating blockchain on the frontend
Downloads
41
Readme
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 numberuseDebounce
Used by this library, provide a debounce functionalityusePendingTransactions
Give all pending transactions for the logged in accountuseSyncProvider
Sync the application with the provider choosen and update the current block by listening to the provideruseTransactionManager
Watch all transaction being made and update on their status by calling notifications and updating the app stateuseTransactions
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 modalsblockChainSlice
all actions and state required for the blockchain ID, blockNumber and blockTimestampnotificationsSlice
all actions and state required for notificationstransactionsSlice
all actions and state required for managing transactions status and history