@clover-network/inpage-provider
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Clover Inpage Provider

The inpage Ethereum provider object injected by Clover into web pages. Contains a lot of implementation details specific to Clover, 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 @clover-network/inpage-provider

Usage

import { initializeProvider } from '@clover-network/inpage-provider'

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

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

const { ethereum } = 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.

Package Sidebar

Install

npm i @clover-network/inpage-provider

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

77.5 kB

Total Files

24

Last publish

Collaborators

  • ldy0909061
  • pangwa
  • werlandy
  • wm-chen