Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uniswap/redux-multicall
A React + Redux library for fetching, batching, and caching chain state via the MultiCall contract.
https://github.com/uniswap/redux-multicall
multicall react redux uniswap
Last synced: 7 days ago
JSON representation
A React + Redux library for fetching, batching, and caching chain state via the MultiCall contract.
- Host: GitHub
- URL: https://github.com/uniswap/redux-multicall
- Owner: Uniswap
- License: mit
- Created: 2021-10-18T16:44:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-19T00:18:59.000Z (about 2 years ago)
- Last Synced: 2024-05-16T09:20:29.915Z (9 months ago)
- Topics: multicall, react, redux, uniswap
- Language: TypeScript
- Homepage:
- Size: 662 KB
- Stars: 93
- Watchers: 6
- Forks: 50
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MultiCall
A React + Redux library for fetching, batching, and caching chain state via the MultiCall contract.
## Setup
`yarn add @uniswap/redux-multicall` or `npm install @uniswap/redux-multicall`
## Usage
The usage of this library is similar to [RTK Query](https://redux-toolkit.js.org/rtk-query/overview#create-an-api-slice).
```js
// Somewhere in your app
export const multicall = createMulticall({ reducerPath: 'multicall' })// In your store's root reducer
export const rootReducer = combineReducers({
// Other reducers
[multicall.reducerPath]: multicall.reducer
})
```To use the updater, you'll need an instance of the Uniswap Multicall2 contract:
```js
import { abi as MulticallABI } from '@uniswap/v3-periphery/artifacts/contracts/lens/UniswapInterfaceMulticall.sol/UniswapInterfaceMulticall.json'
import { Contract } from '@ethersproject/contracts'
import { UniswapInterfaceMulticall } from './abi/types'const multicall2Contract = new Contract(address, MulticallABI, provider) as UniswapInterfaceMulticall
```For a more detailed example, see basic example app in `./integration-tests`
## Alpha software
The latest version of the SDK is used in production in the Uniswap Interface,
but it is considered Alpha software and may contain bugs or change significantly between patch versions.
If you have questions about how to use the SDK, please reach out in the `#dev-chat` channel of the Discord.
Pull requests welcome!