-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from helius-labs/dev
[Merge] Dev -> Main
- Loading branch information
Showing
4 changed files
with
82 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish Helius SDK Crate | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
manual-job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Rust environment | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
profile: minimal | ||
|
||
- name: Publish to crates.io | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: publish | ||
args: --token ${{ secrets.CRATES_IO_TOKEN }} | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use helius_sdk::config::Config; | ||
use helius_sdk::error::HeliusError; | ||
use helius_sdk::rpc_client::RpcClient; | ||
use helius_sdk::types::*; | ||
use helius_sdk::Helius; | ||
|
||
use reqwest::Client; | ||
use solana_client::client_error::ClientError; | ||
use solana_sdk::hash::Hash; | ||
use std::sync::Arc; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), HeliusError> { | ||
let api_key: &str = "your_api_key"; | ||
let cluster: Cluster = Cluster::MainnetBeta; | ||
|
||
let config: Arc<Config> = Arc::new(Config::new(api_key, cluster)?); | ||
let client: Client = Client::new(); | ||
let rpc_client: Arc<RpcClient> = Arc::new(RpcClient::new(Arc::new(client.clone()), Arc::clone(&config)).unwrap()); | ||
|
||
let helius: Helius = Helius { | ||
config, | ||
client, | ||
rpc_client, | ||
}; | ||
|
||
let result: Result<Hash, ClientError> = helius.connection().get_latest_blockhash(); | ||
println!("{:?}", result); | ||
|
||
Ok(()) | ||
} |