0.2.1 • Published 9 months ago

@daohaus/moloch-v3-context v0.2.1

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

@daohaus/moloch-v3-context

DAOhaus moloch-v3-context provides a drop-in context for react applications that can provide data scoped to a provided dao address with hooks for accessing that data in your application components.

This is used throughout our applications and is designed to be leveraged by the larger DAOhaus community as a portal into the DAOhaus ecosystem.

This library was generated with Nx.

Getting Started

Install

yarn add @daohaus/moloch-v3-context

Moloch V3 Context Provider

Start by importing the MolochV3ContextProvider component from the @daohaus/moloch-v3-context package.:

// main.tsx

import { MolochV3ContextProvider } from '@daohaus/moloch-v3-context';

Once imported you can use it as you would any other Context Provider.

  • daoid and daochain are required (dao contracr address and supported network id)
  • if you pass a connected user address it will provide data related to that user's membership in the dao, if applicable
  • if the dao is on mainnet you will need to pass a graph api key
export function DaoContainer() {
  const { daochain, daoid } = useParams();
  const { address } = useDHConnect();

  return (
    <MolochV3ContextProvider address={address} daoid={daoid} daochain={daochain} graphApiKeys={{ '0x1': process.env['NX_GRAPH_API_KEY_MAINNET'] }}>
      <Dao />
    </MolochV3ContextProvider>
  );
}

After including the <DHConnectProvider/> component in your app, you'll be able to access the associated Context throughout your app.

Accessing data

moloch-v3-context exposes several useful hooks that can be used throughout your app. Some examples:

import { useDao, useConnectedMember, useMembers, useProposals } from '@daohaus/moloch-v3-context';

const { dao } = useDao();
const { members, membersNextPaging, loadMoreMembers, sortMembers } = useMembers();
const { connectedMember } = useConnectedMember();
const { isProposalsLoading, proposals, proposalsNextPaging, loadMoreProposals, filterProposals } = useProposals();

Examples

We use DAOhaus Connect in both our Admin app.

Building

Run nx build moloch-v3-context to build the library.

0.1.32

10 months ago

0.2.0-alpha.0

10 months ago

0.2.0-alpha.4

9 months ago

0.2.0-alpha.3

9 months ago

0.2.0-alpha.6

9 months ago

0.2.0-alpha.5

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.31

11 months ago

0.1.30

11 months ago

0.1.27

12 months ago

0.1.28

12 months ago

0.1.29

12 months ago

0.1.25

12 months ago

0.1.26

12 months ago

0.1.21

1 year ago

0.1.22

1 year ago

0.1.23

1 year ago

0.1.24

1 year ago

0.1.20

1 year ago

0.1.19

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.4

1 year ago

0.1.5

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

2 years ago

0.0.1

2 years ago