pod Rust SDK
Rust library for interacting with pod.
Introduction
The pod Rust SDK provides a robust interface for interacting with the pod network through its JSON-RPC API. This SDK enables developers to communicate with pod nodes, manage transactions, and handle network responses in a type-safe manner. The SDK includes comprehensive error handling, serialization management, and strongly-typed responses for pod-specific features.
Getting Started
Installation
To begin using the pod Rust SDK, add the following dependency to your project’s Cargo.toml
Basic Usage
Here’s a simple example demonstrating how to initialize the client and perform basic operations.
Coming from alloy
pod Rust SDK is built on top of alloy. Therefore, alloy could be used to interact with the pod
network, however, this is not recommended, as the pod SDK provides additional essential
functionality such as wait_past_perfect_time, which integrate pod-specific features. Additionally,
using alloy directly may lead to unexpected behavior when waiting for transaction confirmations or
fetching blocks.
The main different between using pod-sdk and alloy is that pod has its own ProviderBuilder, called PodProviderBuilder. The rest of the API remains the same, as it’s illustrated in the example.
PodProvider
The PodProvider serves as the primary interface for interacting with the Pod network. It manages RPC communication and provides methods for executing common operations. PodProvider is built on top of the Alloy Provider trait, making most of its methods Alloy-compatible.
Initialization
Create a new PodProvider instance by using PodProviderBuilder and passing your url.
The same procedure can be repeated for http endpoint
Error Handling
The error handling is identical to the Alloy error handling framework: