Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dioxide-js/detect-provider

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dioxide-js/detect-provider

A tiny utility for detecting the Dioxide-wallet provider which injected at window.dioxide.

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by700%
Maintainers
3
Weekly downloads
 
Created
Source

@dioxide-js/detect-provider

A tiny utility for detecting the Dioxide-wallet provider which injected at window.dioxide after install the diox-wallet chrome extension.

Usage

ES Module
Install
$ yarn add @dioxide-js/detect-provider
import detectDioxideProvider from '@dioxide-js/detect-provider'

const provider = await detectDioxideProvider()

if (provider) {

  console.log('dioxide successfully detected!')

  // From now on, this should always be true:
  // provider === window.dioxide

  // Access the decentralized web!

  const chainId = await provider.request({
    method: 'diox_chainId'
  })
} else {

  // if the provider is not detected, detectDioxideProvider resolves to null
  console.error('Please install Dioxide-Wallet!', error)
}

HTML
<script src="https://unpkg.com/@dioxide-js/detect-provider/dist/detect-provider.umd.js"></script>
<script type="text/javascript">
  const provider = await dioxideDetectProvider({timeout: 3000})
  if (provider) {
    // handle provider
  } else {
    // handle no provider
  }
</script>

Options
options.timeout

Type: number
Default: 3000
Milliseconds to wait for asynchronously injected providers.

Keywords

FAQs

Package last updated on 26 Oct 2022

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