From cf71b48492df8fd5f03d14bd427aeea4bc609be7 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 17 Dec 2024 14:24:04 -0500 Subject: [PATCH] solana: mainnet is actually mainnet-beta, make mainnet an alias for mainnet-beta --- crates/by-chain/icepick-solana/src/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/by-chain/icepick-solana/src/lib.rs b/crates/by-chain/icepick-solana/src/lib.rs index 73981de..8d00c2b 100644 --- a/crates/by-chain/icepick-solana/src/lib.rs +++ b/crates/by-chain/icepick-solana/src/lib.rs @@ -77,7 +77,8 @@ pub enum Error {} pub enum Cluster { Devnet, Testnet, - Mainnet, + #[serde(alias = "mainnet")] + MainnetBeta, } impl std::str::FromStr for Cluster { @@ -87,7 +88,8 @@ impl std::str::FromStr for Cluster { match s { "devnet" => Ok(Self::Devnet), "testnet" => Ok(Self::Testnet), - "mainnet" => Ok(Self::Mainnet), + "mainnet" => Ok(Self::MainnetBeta), + "mainnet-beta" => Ok(Self::MainnetBeta), _ => Err("Invalid value"), } } @@ -98,7 +100,7 @@ impl std::fmt::Display for Cluster { match self { Cluster::Devnet => f.write_str("devnet"), Cluster::Testnet => f.write_str("testnet"), - Cluster::Mainnet => f.write_str("mainnet"), + Cluster::MainnetBeta => f.write_str("mainnet-beta"), } } } @@ -393,7 +395,7 @@ impl Module for Solana { fn handle_request(request: Self::Request) -> Result { match request.operation { Operation::GetBlockhash(GetBlockhash { cluster }) => { - let cluster = cluster.unwrap_or(Cluster::Mainnet); + let cluster = cluster.unwrap_or(Cluster::MainnetBeta); let cluster_url = format!("https://api.{cluster}.solana.com"); let client = solana_rpc_client::rpc_client::RpcClient::new(cluster_url); let response = client.get_latest_blockhash().unwrap(); @@ -631,7 +633,7 @@ impl Module for Solana { })) } Operation::Broadcast(Broadcast { cluster }) => { - let cluster = cluster.unwrap_or(Cluster::Mainnet); + let cluster = cluster.unwrap_or(Cluster::MainnetBeta); let cluster_url = format!("https://api.{cluster}.solana.com"); let blob = request.blob.expect("passed in instruction blob");