Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions canister/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ thread_local! {
},
},
SupportedRpcProviderId::DrpcDevnet => SupportedRpcProvider {
cluster: SolanaCluster::Mainnet,
cluster: SolanaCluster::Devnet,
access: RpcAccess::Unauthenticated {
public_url: "https://solana-devnet.drpc.org".to_string(),
},
Expand All @@ -70,7 +70,7 @@ thread_local! {
},
},
SupportedRpcProviderId::HeliusDevnet => SupportedRpcProvider {
cluster: SolanaCluster::Mainnet,
cluster: SolanaCluster::Devnet,
access: RpcAccess::Authenticated {
auth: RpcAuth::UrlParameter {
url_pattern: "https://mainnet.helius-rpc.com/?api-key={API_KEY}".to_string(),
Expand Down
11 changes: 11 additions & 0 deletions canister/src/providers/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ fn test_rpc_provider_url_patterns() {
}
})
}

#[test]
fn should_have_consistent_name_for_cluster() {
PROVIDERS.with(|providers| {
for (provider_id, provider) in providers {
assert!(provider_id
.to_string()
.ends_with(&provider.cluster.to_string()));
}
})
}
3 changes: 2 additions & 1 deletion libs/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ include = ["src", "Cargo.toml", "CHANGELOG.md", "LICENSE", "README.md"]
[dependencies]
candid = { workspace = true }
canlog = { path = "../../canlog" }
derive_more = { workspace = true }
ic-cdk = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }
url = { workspace = true }
derive_more = { workspace = true }
27 changes: 25 additions & 2 deletions libs/types/src/rpc_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub use ic_cdk::api::management_canister::http_request::HttpHeader;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
use strum::Display;
use thiserror::Error;

/// An RPC result type.
Expand Down Expand Up @@ -146,7 +147,18 @@ impl Debug for RpcEndpoint {

/// [Solana clusters](https://solana.com/docs/references/clusters).
#[derive(
Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, CandidType, Deserialize, Serialize,
Copy,
Clone,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
CandidType,
Deserialize,
Serialize,
Display,
)]
pub enum SolanaCluster {
/// Mainnet: live production environment for deployed applications.
Expand All @@ -159,7 +171,18 @@ pub enum SolanaCluster {

/// Uniquely identifies a supported RPC provider for a particular Solana cluster.
#[derive(
Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, CandidType, Deserialize, Serialize,
Copy,
Clone,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
CandidType,
Deserialize,
Serialize,
Display,
)]
pub enum SupportedRpcProviderId {
/// [Alchemy](https://www.alchemy.com/) provider for [Solana Mainnet](https://solana.com/docs/references/clusters)
Expand Down