Skip to content

Latest commit

 

History

History
104 lines (84 loc) · 2.34 KB

DOCUMENTATION.md

File metadata and controls

104 lines (84 loc) · 2.34 KB

Multichain Database

CI TS GPLv3 license Version Downloads/week

💾 Installation

npm install @web3-systems/multichain-database
yarn add @web3-systems/multichain-database
git clone https://github.com/web3-systems/multichain-database

🏎️  Quickstart

import * as React from 'react';
import { 
  MultiChainProvider, 
  useInitializeDefaultCollections, 
  useGetAccountTransactions 
} from '@web3-systems/react-multichain';

export const Transactions = () => { 
  const { 
    status, 
    data, 
    meta 
  } = useGetAccountTransactions('0x5ed8cee6b63b1c6afce3ad7c92f4fd7e1b8fad9f', 'from', 1);
  return(
    <div>
        <TransactionsTable data={data} />
    </div>
  )
}

export const Contracts = () => { 
  const { 
    status, 
    data, 
    meta 
  } = useGetContractABI('0xb9a179DcA5a7bf5f8B9E088437B3A85ebB495eFe', 1);
  return(
      <div>
          {status === 'LOADING' && return <span>Loading...</span>}
          <ContractRender abi={data} />
      </div>
  )
}

const InnerProvider = ({children}) => { 
  const isReady = useInitializeDefaultCollections(1)
  return(
    <div>
      {isReady && children}
      {!isReady && <div>Loading...</div>}
    </div>
  )
}

export const Providers = () => {
  const chains = [{
    chainId: 1,
    providerUrl: 'https://mainnet.infura.io/v3/INFURA_API_KEY',
    scannerApiKey: 'ETHERSCAN_API_KEY'
  }]

  return (
    <MultiChainProvider chains={chains}>
      <InnerProvider>
        <Transactions />
        <Contracts />
      </InnerProvider>
    </MultiChainProvider>
  );
};


### 📖 &nbsp;Overview

Coming soon...

### 🧩 &nbsp;Examples
Coming soon...

### 💻 &nbsp;Developer Experience

The package is setup using the [TSDX zero-config CLI](https://tsdx.io/) which includes:

- Typescript
- Rollup
- Jest
- Prettier
- ESLint