selene-helius-sdk 0.1.0-beta.1

Rust implementation of the Helius API & RPC
docs.rs failed to build selene-helius-sdk-0.1.0-beta.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: selene-helius-sdk-0.3.2

Selene Helius SDK

Async library for helius API & RPC

use color_eyre::Result;
use selene_helius_sdk::api::das::{GetAssetsByOwnerParams, Supply};
use selene_helius_sdk::HeliusBuilder;

#[tokio::main]
async fn main() -> Result<()> {
  let api_key = std::env::var("HELIUS_API_KEY").expect("env HELIUS_API_KEY is not defined!");
  let helius = HeliusBuilder::new(&api_key).build()?;
  let result = helius
    .get_assets_by_owner(&GetAssetsByOwnerParams {
      owner_address: "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY".to_string(),
      pagination: Default::default(),
      display_options: None,
      sort_by: None,
    })
    .await?;

  println!("total: {}", result.total);
  for asset in result.items {
    println!("{}", asset.id);
  }

  Ok(())
}

Usage

The package needs to be configured with your account's API key, which is available in the Helius Dashboard.

API reference documentation is available at docs.helius.dev.


Supported APIs

DAS API Status

Endpoint Status
getAsset
getAssetBatch
getAssetProof
getAssetProofBatch
getAssetsByOwner
getAssetsByAuthority
getAssetsByCreator
getAssetsByGroup
searchAssets
getSignaturesForAsset
getTokenAccounts

Enriched Transactions

Endpoint Status
transactions
history

Webhooks API Status

Endpoint Status
create-webhook
get-all-webhooks
get-webhook
edit-webhook
delete-webhook
appendAddressesToWebhook

Mint API

Endpoint Status
mintCompressedNft
delegateCollectionAuthority
revokeCollectionAuthority()
getMintlist

Examples

See examples directory for various ways to use the library

  • Create a webhook
HELIUS_API_KEY=<mykey> cargo run --example create_webhook -- \
  https://webhook.site/8dee5d00-b261-423d-8c34-5ebbb8849302 \
  <address>...

Development

To run tests you need to export or create a .env file with the HELIUS_API_KEY

HELIUS_API_KEY=mykey cargo test

Bot

There's an example telegram bot which can create webooks and send solana activity to your telegram channel

  1. Visit https://webhook.site/
  2. cd bot && cargo build --release
 ./target/release/selene-helius-bot webhook create \
   --url <your webhook.site> \
   86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY\
   HHLUSPgvrHBJeVHaANgFTaMVX2YYX25V3CrvktgrLYns 

You can run your own server:

./target/debug/selene-helius-bot serve \
  --helius-api-key <HELIUS_API_KEY> \
  --selene-chat-id <SELENE_CHAT_ID> \
  --teloxide-token <TELOXIDE_TOKEN>

Credits

Inspired by sync library for helius, https://github.com/bgreni/helius-rust-sdk