npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oreid-provider

v1.0.0

Published

EIP-1195 compliant provider for OreID

Downloads

5

Readme

OreIdProviderEip1193

OreIdProviderEip1193 is a JavaScript class that provides an EIP-1193 provider for the ORE ID service. This provider is an adapter layer that interfaces with Ethereum's JSON RPC and allows the use of ORE ID with Ethereum-based libraries and services, like Web3.js and ethers.js, which expect an EIP-1193 provider.

This library is a short circuit to developers re-implementing common functionality when integrating ORE ID with Ethereum-based libraries and services. It is designed to be used in applications that need to interact with Ethereum-based networks through ORE ID.

Dependencies

This package uses the following dependencies:

  • "oreid-js": The ORE ID library.
  • "@ethersproject/providers": Ethers' set of provider abstractions to interact with Ethereum nodes.

Key Components

  • Eip1193Provider Interface: An object containing the methods required by Ethereum's EIP-1193 provider standard.
  • ChainNameIdMapping Interface and ChainNameIdMappings Object: Contain chain names and their corresponding IDs.
  • OreIdProviderEip1193 Class: The main class in this module, providing EIP-1193 compatibility to ORE ID.
  • Constructor: The constructor method is used to initialize the class, setting up the ORE ID instance, selected chain account, selected chain ID, and listeners object.
  • request method: This method is used to handle various JSON-RPC method requests, allowing the class to support transactions, message signing, account fetching, balance checking, and other operations.
  • on and off methods: These methods are used to register and unregister event listeners.
  • handleTransaction, sendTransaction, and signTransaction methods: These methods are used to handle, send, and sign Ethereum transactions using ORE ID.
  • signString method: This method is used to sign a string using a specified signing method via ORE ID.
  • getNonce, getChainAccountsForSelectedChain, getBalance, getBlockNumber, and getChainId methods: These methods are used to interact with the Ethereum network, fetching various pieces of data such as account nonce, chain accounts, account balance, the current block number, and the chain ID.
  • getEthersProvider and getNetworkUrl methods: These methods are used to create an ethers.js provider and fetch the JSON-RPC URL for the specified chain network.

Usage

To use this provider, you will need to:

  • Import the required dependencies.
  • Create an instance of the OreIdProviderEip1193 class, passing the required arguments to the constructor.
  • Call the request method to interact with the Ethereum network. This method handles various JSON-RPC methods according to the method specified in the payload.
  • Register event listeners using the on method and unregister them using the off method.
  • Use the provided methods to interact with the Ethereum network and perform operations like sending and signing transactions.

Events (TODO)

The OreIdProviderEip1193 class can emit various events that you can listen to:

  • connect: Fired when the connection is successfully established.
  • disconnect: Fired when the user disconnects their wallet.
  • accountsChanged: Fired when the selected account changes.
  • chainChanged: Fired when the selected chain changes.
  • networkChanged: Fired when the network changes.
  • message: Fired for incoming messages.

Unfinished work and caveats

  • Add event emitters above for easier integration with wallet abstraction libraries.
  • Add all ORE ID onchain logic I.e. account resolution.
    • Currently a lot of this logic lives in connectors so there's a lot of duplicated code and it's not easy to test.
    • It will make future wallet abstraction libraries trivial to implement with no risk of bugs due to duplicated logic handling wallet lifecycle.

Note: This package is primarily designed for use in applications that need to interact with Ethereum-based networks through ORE ID.