New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@metamask-checker/react

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask-checker/react

React component which uses Render Props approach for checking Metamask inpage provider object

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

React Metamask Checker

License Build Status Coverage Status

Live demo

Description

React component which uses Render Props approach for checking Metamask inpage provider object.

Note: since v2.0.0 only new version of Metamask API is supported. Related links:

Installation

yarn add @metamask-checker/react

# or

npm install --save @metamask-checker/react

Testing

yarn test:jest # Runs Jest with coverage collection
yarn test:coverage # Sends coverage to .coveralls.io
yarn test # yarn test:jest && yarn test:coverage

# or

npm run test:jest
npm run test:coverage
npm test

Usage

// ./containers/App.js

import React, { Component } from 'react'
import MetamaskChecker from '@metamask-checker/react'

import Loader from './components/Loader'
import Err from './components/Error'
import Content from './components/Content'

class App extends Component {

  async initialize (provider, account, network) {
    console.log(provider, account, network)
  }

  render () {

    const props = {
      /* Ethereum network_id (numeric) which should be selected in Metamask */
      // network : null,

      /* Ethereum account (address) which should be selected in Metamask */
      // account : null,

      /* Function which executes on checking error */
      // onCheckError   : async (error) => null,

      /* Function which executes on checking success */
      onCheckSuccess : async (provider, account, network) => await this.initialize(provider, account, network),

      renderDefault : () => <Loader />,

      renderErrored : error => <Err message={error.message || 'Unexpected error'} />,

      renderChecked : (provider, account, network) => <Content />
    }

    return <MetamaskChecker {...props} />
  }
}

Keywords

FAQs

Package last updated on 31 Jan 2020

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