Socket
Socket
Sign inDemoInstall

@rimble/network-indicator

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rimble/network-indicator

Web3 React component built with Rimble UI that will display the current ethereum network name based on a given network ID.


Version published
Maintainers
2
Created
Source

Rimble Network Indicator - current network

Rimble Network Indicator - wrong network

Rimble Network Indicator - no network

@rimble/network-indicator

React component built with Rimble UI that will display the current Ethereum network name based on a given network ID and optionally display and icon and tooltip indicating whether the user is on the correct network for the application.

Installation

Install the package in your project directory with:

// with npm
npm install @rimble/network-indicator

// with yarn
yarn add @rimble/network-indicator

Usage Example

import NetworkIndicator from '@rimble/network-indicator';

// Default
<NetworkIndicator currentNetwork={3} />;

// Has requiredNetwork prop
<NetworkIndicator currentNetwork={3} requiredNetwork={1} />;

// Custom tooltips for default
<NetworkIndicator currentNetwork={1}>
  {{
    onNetworkMessage: 'Connected to correct network',
    noNetworkMessage: 'Not connected to anything'
  }}
</NetworkIndicator>

// Custom tooltips with requiredNetwork prop
<NetworkIndicator currentNetwork={null} requiredNetwork={1}>
  {{
    onNetworkMessage: 'Connected to correct network',
    noNetworkMessage: 'Not connected to anything',
    onWrongNetworkMessage: 'Wrong network',
  }}
</NetworkIndicator>

Props

NameTypeDefaultDescription
currentNetworkintegernoneThe network ID that the user is connected to, if available
requiredNetworkintegernoneThe network ID that the dApp requires to function
onNetworkMessagestringnoneContent of a hover tooltip when there is a currentNetwork prop and when requiredNetwork exists and matches currentNetwork prop
noNetworkMessagestringsee default messagesContent of a hover tooltip when there is a null value for currentNetwork prop even when there is a requiredNetwork prop
onWrongNetworkMessagestringsee default messagesContent of a hover tooltip when values do not match for currentNetwork and requiredNetwork props

Default Messages

onNetworkMessage

Only when requiredNetwork exists and matches currentNetwork prop

You're on the right network

noNetworkMessage

You're not on an Ethereum network

onWrongNetworkMessage

You're on the wrong network

Issues

Open an issue for any bugs or feature requests

Contributing

We are open source and welcome your contributions !

License

MIT © ConsenSys

Keywords

FAQs

Package last updated on 16 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc