diff --git a/crates/by-chain/icepick-solana/src/lib.rs b/crates/by-chain/icepick-solana/src/lib.rs index 42ccabc..8ef8014 100644 --- a/crates/by-chain/icepick-solana/src/lib.rs +++ b/crates/by-chain/icepick-solana/src/lib.rs @@ -72,7 +72,7 @@ const LAMPORTS_PER_SOL: u64 = 1_000_000_000; #[derive(thiserror::Error, Debug)] pub enum Error {} -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)] #[serde(rename_all = "kebab-case")] pub enum Cluster { Devnet, @@ -623,7 +623,10 @@ impl Module for Solana { "derivation_accounts": [0u32 | 1 << 31], })) } - Operation::Sign(Sign { blockhash, mut transaction }) => { + Operation::Sign(Sign { + blockhash, + mut transaction, + }) => { let keys = request .derived_keys .unwrap_or_default() @@ -641,7 +644,10 @@ impl Module for Solana { } })) } - Operation::Broadcast(Broadcast { cluster, transaction }) => { + Operation::Broadcast(Broadcast { + cluster, + transaction, + }) => { let cluster = cluster.unwrap_or(Cluster::MainnetBeta); let cluster_url = format!("https://api.{cluster}.solana.com"); @@ -649,12 +655,20 @@ impl Module for Solana { let client = solana_rpc_client::rpc_client::RpcClient::new(cluster_url); let _simulated_response = client.simulate_transaction(&transaction).unwrap(); let response = client.send_and_confirm_transaction(&transaction); + let cluster_suffix = { + if cluster != Cluster::MainnetBeta { + String::new() + } else { + format!("?cluster={cluster}") + } + }; Ok(match response { Ok(s) => { serde_json::json!({ "blob": { "status": "send_and_confirm", "succcess": s.to_string(), + "url": format!("https://explorer.solana.com/tx/{s}{cluster_suffix}"), } }) }