-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
162 additions
and
0 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,31 @@ | ||
use helius_sdk::config::Config; | ||
use helius_sdk::error::HeliusError; | ||
use helius_sdk::rpc_client::RpcClient; | ||
use helius_sdk::types::{Asset, Cluster, GetAssetBatch, GetAssetOptions}; | ||
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: Config = Config::new(api_key, cluster)?; | ||
let client: reqwest::Client = reqwest::Client::new(); | ||
let rpc_client: RpcClient = RpcClient::new(Arc::new(client), Arc::new(config))?; | ||
|
||
let request: GetAssetBatch = GetAssetBatch { | ||
ids: vec![ | ||
"81bxPqYCE8j34nQm7Rooqi8Vt3iMHLzgZJ71rUVbQQuz".to_string(), | ||
"CWHuz6GPjWYdwt7rTfRHKaorMwZP58Spyd7aqGK7xFbn".to_string(), | ||
], | ||
display_options: Some(GetAssetOptions { | ||
show_collection_metadata: true, | ||
..Default::default() | ||
}), | ||
}; | ||
|
||
let response: Result<Vec<Option<Asset>>, HeliusError> = rpc_client.get_asset_batch(request).await; | ||
println!("Assets: {:?}", response); | ||
|
||
Ok(()) | ||
} |
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,35 @@ | ||
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 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 request: ParseTransactionsRequest = ParseTransactionsRequest { | ||
transactions: vec![ | ||
"2sShYqqcWAcJiGc3oK74iFsYKgLCNiY2DsivMbaJGQT8pRzR8z5iBcdmTMXRobH8cZNZgeV9Ur9VjvLsykfFE2Li".to_string(), | ||
], | ||
}; | ||
|
||
let response: Result<Vec<EnhancedTransaction>, HeliusError> = helius.parse_transactions(request).await; | ||
println!("Assets: {:?}", response); | ||
|
||
Ok(()) | ||
} |
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,39 @@ | ||
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 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: reqwest::Client = reqwest::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 request: GetPriorityFeeEstimateRequest = GetPriorityFeeEstimateRequest { | ||
transaction: None, | ||
account_keys: Some(vec!["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4".to_string()]), | ||
options: Some(GetPriorityFeeEstimateOptions { | ||
priority_level: Some(PriorityLevel::High), | ||
include_all_priority_fee_levels: None, | ||
transaction_encoding: None, | ||
lookback_slots: None, | ||
}), | ||
}; | ||
|
||
let response: Result<GetPriorityFeeEstimateResponse, HeliusError> = | ||
helius.rpc().get_priority_fee_estimate(request).await; | ||
println!("Assets: {:?}", response); | ||
|
||
Ok(()) | ||
} |
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,57 @@ | ||
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 serde_json::Value; | ||
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: reqwest::Client = reqwest::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 request: MintCompressedNftRequest = MintCompressedNftRequest { | ||
name: "Exodia the Forbidden One".to_string(), | ||
symbol: "ETFO".to_string(), | ||
owner: "DCQnfUH6mHA333mzkU22b4hMvyqcejUBociodq8bB5HF".to_string(), | ||
description: "Exodia the Forbidden One is a powerful, legendary creature composed of five parts: the Right Leg, Left Leg, Right Arm, Left Arm, and the Head. When all five parts are assembled, Exodia becomes an unstoppable force".to_string(), | ||
attributes: vec![Attribute { | ||
trait_type: "Type".to_string(), | ||
value: Value::String("Legendary".to_string()), | ||
}, Attribute { | ||
trait_type: "Power".to_string(), | ||
value: Value::String("Infinite".to_string()), | ||
}, Attribute { | ||
trait_type: "Element".to_string(), | ||
value: Value::String("Dark".to_string()), | ||
}, Attribute { | ||
trait_type: "Rarity".to_string(), | ||
value: Value::String("Mythical".to_string()), | ||
}, | ||
], | ||
image_url: Some("https://cdna.artstation.com/p/assets/images/images/052/118/830/large/julie-almoneda-03.jpg?1658992401".to_string()), | ||
external_url: Some("https://www.yugioh-card.com/en/".to_string()), | ||
seller_fee_basis_points: Some(6900), | ||
delegate: None, | ||
collection: None, | ||
uri: None, | ||
creators: None, | ||
confirm_transaction: Some(true), | ||
}; | ||
|
||
let response: Result<MintResponse, HeliusError> = helius.mint_compressed_nft(request).await; | ||
println!("Assets: {:?}", response); | ||
|
||
Ok(()) | ||
} |