npm:
npm i @lavanet/lava-web3
- create
- new...init()
- new()...relay
import Web3 from "web3";
import { LavaWeb3Provider } from "@lavanet/lava-web3";
async function createWeb3Instance {
// the provider will be initialized automatically by the create() command
const provider = await LavaWeb3Provider.create({
badge: {
badgeServerAddress: "https://badges.lavanet.xyz",
projectId: "//" //login to gateway.lavanet.xyz to get a projectId!
},
chainIds: "ETH1",
geolocation: "1" //optional
});
return new Web3(provider);
}
import Web3 from "web3";
import { LavaWeb3Provider } from "@lavanet/lava-web3";
async function createWeb3Instance {
// the provider will be initialized manually by the init() command
const provider = new LavaWeb3Provider({
badge: {
badgeServerAddress: "https://badges.lavanet.xyz",
projectId: "//" //login to gateway.lavanet.xyz to get a projectId!
},
chainIds: "ETH1",
geolocation: "1" //optional
});
//provider is initialized by the following command
await provider.init();
return new Web3(provider);
}
import Web3 from "web3";
import { LavaWeb3Provider } from "@lavanet/lava-web3";
async function createWeb3Instance {
// the provider will be initialized automatically on the first request
const provider = new LavaWeb3Provider({
badge: {
badgeServerAddress: "https://badges.lavanet.xyz",
projectId: "//" //login to gateway.lavanet.xyz to get a projectId!
},
chainIds: "ETH1",
geolocation: "1" //optional
});
//provider will be initialized at first relay
return new Web3(provider);
}
❓ Looking for more examples? Check out the examples folder on our repository.