# @gasrunners/evm-fetch

> Fetch onchain data from the EVM chain contracts using multicaller contract

Latest version **1.0.0** (published 2023-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gasrunners/evm-fetch
pnpm add @gasrunners/evm-fetch
yarn add @gasrunners/evm-fetch
bun add @gasrunners/evm-fetch
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-01-04 |
| First published | 2023-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | 0xgafu |
| Keywords | Ethereum, Web3, Multicaller |

## Links

- npm: https://www.npmjs.com/package/@gasrunners/evm-fetch
- Repository: https://github.com/gasrunnners/workshop
- Homepage: https://github.com/gasrunnners/workshop/tree/main/packages/evm-fetch
- Issues: https://github.com/gasrunnners/workshop/issues
- npm.io page: https://npm.io/package/@gasrunners/evm-fetch

## Dependencies (4)

- [lodash.set](https://npm.io/package/lodash.set.md) ^4.3.2
- [@ethersproject/abi](https://npm.io/package/@ethersproject/abi.md) ^5.7.0
- [@ethersproject/contracts](https://npm.io/package/@ethersproject/contracts.md) ^5.7.0
- [@ethersproject/providers](https://npm.io/package/@ethersproject/providers.md) ^5.7.1

## Recent versions

- 1.0.0 (latest) — 2023-01-04

## README

# EVMFetch

[![npm
(tag)](https://img.shields.io/npm/v/@gasrunners/evm-fetch)](https://www.npmjs.com/package/@gasrunners/evm-fetch)

EVMFetch is a simple wrapper around multicaller contracts that makes fetching
onchain data simple and intuitive.

## Usage

Install:

```bash
npm install @gasrunners/evm-fetch
```

Instantiate an EVMFetch instance:

```ts
import { EVMFetch, Network } from '@gasrunners/evm-fetch'
import { ERC20_ABI } from '@gasrunners/common-abi'

evmFetch = new EVMFetch({
  network: Network.MAINNET,
  provider: <YOUR_RPC_URL> // e.g. `https://mainnet.infura.io/v3/${YOUR_INFURA_KEY}`,
})
```

Add multical onchain calls from different contracts:

```ts
evmFetch
  .addCall({
    key: 'dai.name',
    address: '0x6B175474E89094C44Da98b954EedeAC495271d0F', // Dai ERC20
    function: 'name',
    abi: ERC20_ABI,
  })
  .addCall({
    key: 'uni.name',
    address: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', // Uniswap ERC20
    function: 'name',
    abi: ERC20_ABI,
  })
```

Then fetch the results:

```ts
const data = await evmFetch.fetch()

console.log(data) // { dai: 'Dai Stablecoin', uni: 'Uniswap' }
```

---
_Source: https://npm.io/package/@gasrunners/evm-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
