Crate shyft_rs_sdk

Crate shyft_rs_sdk 

Source
Expand description

§Shyft Rust SDK

Shyft SDK is a Rust library for interacting with the Shyft API.

This is not an official SDK. It is a personal project for learning Rust and API development. The included endpoints are primarily for personal use in my own projects and may not cover all features of the Shyft API.

§Features

  • Configurable retry strategy for API requests.
  • Fetch transaction history for a given account.
  • Retrieve parsed transaction details for a specific transaction signature.
  • Fetch parsed bulk transactions in a single call.

§Configuration

You can configure the retry strategy by providing optional parameters when creating the ShyftApi instance:

  • min_retry_interval: Minimum retry interval in milliseconds.
  • max_retry_interval: Maximum retry interval in milliseconds.
  • max_retries: Maximum number of retries.
  • network: Network to interact with(mainnet-beta, devnet, testnet).
  • commitment: Commitment level for transactions(confirmed, finalised).

§Usage

§Creating a ShyftApi Instance

use shyft_rs_sdk::ShyftApi;

let api_key = "your_api_key";
let client = ShyftApi::new(api_key, None, None, None, None, None)
    .expect("Failed to create ShyftApi");

§Fetching Transaction History

Equivalent to GET /transaction/history

let account = "your_account_address";
let transaction_history = client
    .get_transaction_history(account, Some(10), None, None, Some(true), None)
    .await?;
println!("{:?}", transaction_history);

§Fetching Parsed Transaction Details

Equivalent to GET /transaction/parsed

let tx_signature = "your_transaction_signature";
let parsed_transaction_details = client
    .get_transaction_parsed(tx_signature)
    .await
    .expect("Failed to fetch parsed transaction details");
println!("{:?}", parsed_transaction_details);

§Fetching Parsed Bulk Transactions

Equivalent to POST /transaction/parse_selected

let tx_signatures = vec![
    "your_transaction_signature_1".to_owned(),
    "your_transaction_signature_2".to_owned(),
];
let parsed_transactions = client
    .get_transaction_parse_selected(&tx_signatures, Some(true), Some(true))
    .await
    .expect("Failed to fetch parsed bulk transactions");
println!("{:?}", parsed_transactions);

Modules§

models
Contains all the model structs used in the Shyft Rust SDK.

Structs§

ShyftApi
Struct representing the Shyft API client

Enums§

Commitment
Enum representing the commitment level for transactions.
Error
Enum representing custom error types for the Shyft API.
Network
Enum representing different Shyft API networks.