Socket
Book a DemoInstallSign in
Socket

@manifoldxyz/frontend-provider-utils

Package Overview
Dependencies
Maintainers
10
Versions
10
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

latest
Source
npmnpm
Version
2.2.1
Version published
Weekly downloads
42
Maintainers
10
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 15 Apr 2025

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