Socket
Book a DemoInstallSign in
Socket

@gasnow/inpage-provider

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gasnow/inpage-provider

A JavaScript Ethereum provider that connects to the wallet over a stream.

latest
Source
npmnpm
Version
0.1.8
Version published
Maintainers
2
Created
Source

Gasnow Inpage Provider

The inpage Ethereum provider object injected by Gasnow into web pages. Contains a lot of implementation details specific to Gasnow, and is probably not suitable for out-of-the-box use with other wallets.

Implements the Ethereum JavaScript provider specification, EIP-1193.

Installation

yarn add @gasnow/inpage-provider

Usage

import { initializeProvider } from '@gasnow/inpage-provider';

// Create a stream to a remote provider:
const gasnowStream = new LocalMessageDuplexStream({
  name: 'inpage',
  target: 'contentscript',
});

// this will initialize the provider and set it as window.ethereum
initializeProvider({
  connectionStream: gasnowStream,
});

const { gasnow } = window;

Types

Types are exposed at index.d.ts. They require Node.js EventEmitter and Duplex stream types, which you can grab from e.g. @types/node.

Do Not Modify the Provider

The Provider object should not be mutated by consumers under any circumstances. The maintainers of this package will neither fix nor take responsbility for bugs caused by third parties mutating the provider object.

Running tests

yarn test

Keywords

Gasnow

FAQs

Package last updated on 25 May 2021

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