# @daohaus/moloch-v3-data

> The `moloch-v3-data` package was developed to encapsulate our subgraphs, empowering you to perform common queries across diverse entities with ease. The library is designed with optimization at its core, transforming the data you receive into a highly use

Latest version **0.5.5** (published 2025-03-03) · 0 weekly downloads

## Install

```sh
npm install @daohaus/moloch-v3-data
pnpm add @daohaus/moloch-v3-data
yarn add @daohaus/moloch-v3-data
bun add @daohaus/moloch-v3-data
```

## Health

**Score 40/100 (D)** — status: stable.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.5.5 |
| Published | 2025-03-03 |
| First published | 2022-11-02 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 16 |
| Unpacked size | 374.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 25 |
| Maintainers | daohaus-protocol |

## Links

- npm: https://www.npmjs.com/package/@daohaus/moloch-v3-data
- Repository: https://github.com/HausDAO/monorepo
- Homepage: https://github.com/HausDAO/monorepo#readme
- Issues: https://github.com/HausDAO/monorepo/issues
- npm.io page: https://npm.io/package/@daohaus/moloch-v3-data

## Dependencies (16)

- [viem](https://npm.io/package/viem.md) 1.6.0
- [react](https://npm.io/package/react.md) 18.2.0
- [tslib](https://npm.io/package/tslib.md) 2.6.1
- [wagmi](https://npm.io/package/wagmi.md) 1.3.10
- [numbro](https://npm.io/package/numbro.md) 2.3.6
- [graphql](https://npm.io/package/graphql.md) 16.3.0
- [date-fns](https://npm.io/package/date-fns.md) 2.30.0
- [cross-fetch](https://npm.io/package/cross-fetch.md) 3.1.8
- [localforage](https://npm.io/package/localforage.md) 1.10.0
- [@daohaus/utils](https://npm.io/package/@daohaus/utils.md) 0.5.5
- [graphql-request](https://npm.io/package/graphql-request.md) 4.3.0
- [react-hook-form](https://npm.io/package/react-hook-form.md) 7.45.4
- [@0xsequence/indexer](https://npm.io/package/@0xsequence/indexer.md) 2.2.14
- [@daohaus/keychain-utils](https://npm.io/package/@daohaus/keychain-utils.md) 0.5.5
- [@daohaus/data-fetch-utils](https://npm.io/package/@daohaus/data-fetch-utils.md) 0.5.5
- [@graphql-typed-document-node/core](https://npm.io/package/@graphql-typed-document-node/core.md) 3.2.0

## Recent versions

- 0.5.5 (latest) — 2025-03-03
- 0.2.0-alpha.6 (alpha) — 2023-08-18
- 0.5.4 — 2024-10-29
- 0.5.3 — 2024-09-06
- 0.5.2 — 2024-06-14
- 0.5.1 — 2024-05-09
- 0.5.0 — 2024-05-03
- 0.4.5 — 2024-05-02
- 0.4.4 — 2024-03-29
- 0.4.3 — 2024-03-21
- 0.4.2 — 2024-01-26
- 0.4.1 — 2024-01-18
- 0.4.0 — 2024-01-17
- 0.3.3 — 2023-12-19
- 0.3.2 — 2023-11-10
- … 43 more at https://npm.io/package/@daohaus/moloch-v3-data/versions

## README

# @daohaus/moloch-v3-data

The `moloch-v3-data` package was developed to encapsulate our subgraphs, empowering you to perform common queries across diverse entities with ease. The library is designed with optimization at its core, transforming the data you receive into a highly user-friendly and easy-to-manipulate format.

The library's functions let you find single entities or query lists, and the list queries are supplemented with several helper tools for paginating, filtering and sorting.

### [View on NPM](https://www.npmjs.com/package/@daohaus/moloch-v3-data)

## Usage

### Installation

```bash
yarn add @daohaus/moloch-v3-data
```

### Requirements

If you are trying to query for data on Etheruem Mainnet or Gnosis Chain (and more to come) you will need to provide an api Key from The Graph. Learn to get those [here](https://thegraph.com/docs/en/querying/managing-api-keys/) and [here](https://thegraph.com/studio/apikeys/).

### Examples

**How to find a single entity by ID.**

```ts
import { findDao } from '@daohaus/moloch-v3-data';

const daoRes = await findDao({
  networkId: '0x1',
  dao: '0x0DaoContractAddress',
  includeTokens: true,
  graphApiKeys: {
    '0x1': 'graphApiKey',
  },
});
```

**How to find a a list of entities.**

```ts
import { listProposals, Proposal_Filter, Proposal_OrderBy } from '@daohaus/moloch-v3-data';

const list = await listProposals({
  networkId: '0x1',
  filter: {
    createdAt_gte: '1656693140',
  },
  ordering: {
    orderBy: 'createdAt',
    orderDirection: 'asc',
  },
  paging: {
    pageSize: '20',
    offset: '1',
  },
  graphApiKeys: {
    '0x1': 'graphApiKey',
  },
});
```

**_Filtering_**
Provide any query the graph supports on fields within the entity you are querying. The Graph docs contain examples on [filtering](https://thegraph.com/docs/en/querying/graphql-api/#filtering).

**_Ordering_**
Provide a field to order by and the order direction (asc or desc).

**_Paging_**
The SDK supports offest and cursor pagination. Cursor pagination overrides the ordering to the ID field. Pagination defaults to returning the first 100 results and provides the query required to get to the next page.

```js
{
  pageSize: '20',
  offset: '0'
}

{
  pageSize: '2000',
  lastId: '0'
}
```

## Building

Run `nx run moloch-v3-data:build` to build the library.

## Generating GraphQL Schema and Types

1. When updates are deployed to the moloch-v3haus V3 subgraphs, a new schema should be generated

   run `nx generate-gql-schema moloch-v3-data` to create a new `src/subgraph/schema.graphql` file

2. When there is a new schema or new query files are added, new types should be generated

   run `nx generate-gql-types moloch-v3-data` to create type files for each query file in `src/subgraph/queries`

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