Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.

PolymathNetwork/polymath-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polymath-react

Reusable React.js components and hooks

This repo contains two reusable pieces that are common amongst all Polymath standalone apps:

  • const {error, sdk, networkId, walletAddress} = usePolymathSdk(): call this hook inside your functional components. It will attempt to:
    • instantiate an SDK instance.
    • Connect to Polymath network
    • Get the current browser wallet address (eg from Metamask)
    • return an error, if any.
  • const {error, tokenSelector, tokens, tokenIndex} = useTokenSelector(sdk, walletAddress): call this hook to fetch all the seurity tokens that are either owned by walletAddress or are delegated to be managed by walletAddress. The hook returns:
    • tokens an array of security token objects.
    • tokenSelector a React select list that enables selecting a token to manage.
    • tokenIndex is the index of currently selected token if any.

Installation

  • yarn add PolymathNetwork/react. Yes, we will release this repo as an npm pacakge soon!

Example

To see those hooks actions please checkout our role management app.

About

Reusable React.js components and hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published