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

@manifoldxyz/frontend-provider-utils

Package Overview
Dependencies
Maintainers
13
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@manifoldxyz/frontend-provider-utils

A tiny utility for detecting the Manifold Ethereum provider, an injected `window.ManifoldEthereumProvider` object

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49
decreased by-57.39%
Maintainers
13
Weekly downloads
 
Created
Source

frontend-provider-utils

A tiny utility for detecting the Manifold Ethereum provider, an injected window.ManifoldEthereumProvider object

Installation

Install this package using npm:

npm install @manifoldxyz/frontend-provider-utils

Or using yarn:

yarn add @manifoldxyz/frontend-provider-utils

Usage

Node.js


import { detectManifoldEthereumProvider } from '@manifoldxyz/frontend-provider-utils'

const manifoldProvider = await detectManifoldEthereumProvider()

if (provider) {

  console.log('Manifold Ethereum successfully detected!')

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

  const oAuthToken = await manifoldProvider.getOAuth({
    appName,
    clientId,
    grantType,
    strictAuth
  });
} else {
  // if the provider is not detected, detectManifoldEthereumProvider resolves to null
}

Options

The exported function takes an optional options object. If invalid options are provided, an error will be thrown. All options have default values.

options.silent Type: boolean

Default: false

Whether error messages should be logged to the console. Does not affect errors thrown due to invalid options.

options.timeout Type: number

Default: 3000

How many milliseconds to wait for asynchronously injected manifold provider.

Advanced Topics

The Manifold Ethereum Provider is synchronously injected.

To notify sites of the injection, Manifold Ethereum Provider dispatches the 'manifold-ethereum-initialized' event on window immediately after the provider has been set as window.ManifoldEthereumProvider. This package relies on that event to detect the injection.

Overwriting or Modifying window.ManifoldEthereumProvider.

The detected provider object returned by this package will strictly equal (===) window.ManifoldEthereumProvider for the entire page lifecycle, unless window.ManifoldEthereumProvider is overwritten. Consumers should never overwrite window.ManifoldEthereumProvider or attempt to modify the provider object.

Contributing

Contributions are welcome. Please open an issue or submit a pull request on our GitHub repository.

FAQs

Package last updated on 12 Jun 2024

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