@direct.dev/viem
v0.7.2
Published
Viem client for Direct.dev, optimizing performance and enhancing reliability.
Readme
@direct.dev/viem
A viem-compatible client 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 Viem clients
- 🛡 Dependency-free, ensuring security and stability
- 📉 Lower latency and costs with efficient request routing
Installation
npm install @direct.dev/viem [email protected]
# or
yarn add @direct.dev/viem [email protected]
# or
pnpm add @direct.dev/viem [email protected]Usage
// Import dependencies
import { mainnet } from "viem/chains";
import createPublicClient from "@direct.dev/viem";
// Initialize the Direct.dev client
const client = createPublicClient(
// Direct configurations
{
projectId: "your-project-id", // From the Direct.dev dashboard
projectToken: "************", // From the Direct.dev dashboard
},
mainnet,
// Viem configurations (Optional)
{
pollingInterval: 1000
}
);
// Example: Fetch the latest block number
const blockNumber = await client.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].
