Socket
Socket
Sign inDemoInstall

fugaomnis

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fugaomnis

Collection of Lava implementation for different providers


Version published
Maintainers
1
Created

Readme

Source


Logo

Lava Ethers Provider - ALPHA

Use the Ethers.js, the Lava way 🌋

This repository contains implementations of Ether.js provider using Lava-SDK to achive decentralized access.

(back to top)

Installation

Prerequisites (Alpha version)

SDK setup requires additional steps at the moment, but we're working on minimizing prerequisites as we progress through the roadmap.

  1. Create a wallet on the Lava Testnet, have LAVA tokens
  2. Stake in the chain you want to access
  3. Stake in Lava chain

Need help? We've got you covered 😻 Head over to our Discord channel #developers and we'll provide testnet tokens and further support

Yarn

yarn add lava-sdk-providers

NPM

npm install lava-sdk-providers

(back to top)

Usage

To use the LavaEthersProvider, you will first need to import and initialize it.

const ethersProvider = await new LavaEthersProvider({
  privKey: privKey,
  chainID: chainID,
  pairingListConfig: localConfigPath, // Optional
  networkId: networkID, // Optional
});
  • privateKey parameter is required and should be the private key of the staked Lava client for the specified chainID.

  • chainID parameter is required and should be the ID of the chain you want to query. You can find all supported chains with their IDs supportedChains

  • pairingListConfig is an optional field that specifies the lava pairing list config used for communicating with lava network. Lava SDK does not rely on one centralized rpc for querying lava network. It uses a list of rpc providers to fetch list of the providers for specified chainID and rpcInterface from lava network. If not pairingListConfig set, the default list will be used default lava pairing list

  • networkId represents chain id of the network we want to query. By default every supported chain has matching chain id (https://github.com/lavanet/lava-sdk-providers/blob/main/ethersjs/supportedChains.json)

Once the LavaEthersProvider is initialized, you can use any method provided by the Ether.js library to interact with the blockchain. For example, to get the latest block number, you can use the following code:

const blockNumber = await ethersProvider.getBlockNumber();

This will return the block number of the latest block on the specified chain. You can find more information on available methods in the official Ether.js documentation

(back to top)

Keywords

FAQs

Last updated on 29 Mar 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc