@direct.dev/web3
v0.7.2
Published
Web3.js provider for Direct.dev, optimizing performance and enhancing reliability.
Readme
@direct.dev/web3
A web3.js-compatible provider that integrates with the Direct.dev RPC infrastructure, providing read-layer caching for improved performance and reduced costs.
Features
- 🚀 Optimized RPC calls via Direct.dev
- 🔌 Drop-in replacement for your existing Web3 providers
- 🛡 Dependency-free, ensuring security and stability
- 📉 Lower latency and costs with efficient request routing
Installation
npm install @direct.dev/web3 web3
# or
yarn add @direct.dev/web3 web3
# or
pnpm add @direct.dev/web3 web3Usage
// Import dependencies
import Web3 from "web3";
import DirectProvider from "@direct.dev/web3";
// Initialize the Direct.dev provider
const provider = new DirectProvider({
projectId: "your-project-id", // From the Direct.dev dashboard
projectToken: "************", // From the Direct.dev dashboard
networkId: "your-network-id", // e.g. "ethereum", "polygon"
providers: ["https://your-provider-endpoint.com/"],
});
// Create a Web3 instance using the Direct provider
const web3 = new Web3(provider);
// Example: Fetch the latest block number
const blockNumber = await web3.eth.getBlockNumber();Documentation
For full API reference and detailed usage guides, visit our official documentation.
Support
Join our Discord community for discussions and support.
License
🛡️ License: This software is provided under the Direct.dev Terms and Conditions.
Use of this software requires agreement to those terms.
For inquiries, contact [email protected].
