@daohaus/keychain-utils
TypeScript icon, indicating that this package has built-in type declarations

0.5.1 • Public • Published

@daohaus/keychain-utils

keychain-utils is a comprehensive reference point for managing chain-specific DAO data. It provides an easy way to retrieve a list of constants for any given chain. These constants include contract addresses, API endpoints, TheGraph endpoints, and block explorers. The keychain-utils are structured as objects, with chain IDs serving as the keys to these objects.

Usage

Installation

yarn add @daohaus/keychain-utils

Examples

How to create a link to the block explorer for an address or transaction

import { generateExplorerLink } from '@daohaus/keychain-utils';

const contractLink = generateExplorerLink({ chainId: '0x1', address: '0x0address', type: 'address' });

const txLink = generateExplorerLink({ chainId: '0x5', address: '0x0TxHash', type: 'tx' });

How to get contract addresses for each supported network

import { CONTRACT_KEYCHAINS } from '@daohaus/keychain-utils';

const vaultSummoner = CONTRACT_KEYCHAINS['VAULT_SUMMONER']['0x1'];

How to get subgraph endpoints for each supported network

import { ENDPOINTS } from '@daohaus/keychain-utils';

const arbitrumGraph = ENDPOINTS['V3_SUBGRAPH']['0xa'];

const hydratedEndpoints = addApiKeyToGraphEnpoints({ '0x1': 'someGraphApiKey' }, ENDPOINTS);
const mainnetGraph = hydratedEndpoints['V3_SUBGRAPH']['0x1'];

How to get the name of a network from the id

import { getNetworkName } from '@daohaus/keychain-utils';

const name = getNetworkName('0x64');

Building

Run nx run keychain-utils:build to build the library.

Readme

Keywords

none

Package Sidebar

Install

npm i @daohaus/keychain-utils

Weekly Downloads

53

Version

0.5.1

License

none

Unpacked Size

35.4 kB

Total Files

29

Last publish

Collaborators

  • daohaus-protocol