Skip to content

Commit c65f33d

Browse files
committed
Add aliases
1 parent c7e9120 commit c65f33d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

subrpc-core/src/endpoint.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ pub struct Endpoint {
1111
#[serde(default = "empty_string_array")]
1212
pub labels: Vec<String>,
1313

14+
/// Optional aliases
15+
#[serde(default = "empty_string_array")]
16+
pub aliases: Vec<String>,
17+
1418
/// Endpoint URL
1519
pub url: EndpointUrl,
1620

@@ -27,11 +31,12 @@ impl PartialEq for Endpoint {
2731
impl Eq for Endpoint {}
2832

2933
impl Endpoint {
30-
pub fn new(name: &str, url: &str, labels: Vec<String>) -> Self {
34+
pub fn new(name: &str, url: &str, labels: Vec<String>, aliases: Vec<String>) -> Self {
3135
Self {
3236
name: name.to_string(),
3337
url: EndpointUrl::try_from(url).unwrap(),
3438
labels,
39+
aliases,
3540
stats: EndpointStats::default(),
3641
}
3742
}

subrpc-core/src/registry.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,24 @@ impl Registry {
168168
(
169169
"Polkadot".to_string(),
170170
vec![
171-
Endpoint::new("Parity", "wss://rpc.polkadot.io:443", vec!["Parity".to_string()]),
171+
Endpoint::new("Parity", "wss://rpc.polkadot.io:443", vec!["Parity".to_string()], vec![]),
172172
Endpoint::new(
173173
"OnFinality",
174174
"wss://polkadot.api.onfinality.io:443/public-ws",
175175
vec!["OnFinality".to_string()],
176+
vec![],
176177
),
177178
],
178179
),
179180
(
180181
"Kusama".to_string(),
181182
vec![
182-
Endpoint::new("Parity", "wss://kusama-rpc.polkadot.io:443", vec!["Parity".to_string()]),
183+
Endpoint::new("Parity", "wss://kusama-rpc.polkadot.io:443", vec!["Parity".to_string()], vec![]),
183184
Endpoint::new(
184185
"Parity Bad",
185186
"wss://bad-rpc.polkadot.io:443",
186187
vec!["Parity".to_string(), "Bad".to_string()],
188+
vec![],
187189
),
188190
],
189191
),
@@ -199,17 +201,18 @@ impl Default for Registry {
199201
(
200202
"Polkadot".to_string(),
201203
vec![
202-
Endpoint::new("Parity", "wss://rpc.polkadot.io:443", vec!["Parity".to_string()]),
204+
Endpoint::new("Parity", "wss://rpc.polkadot.io:443", vec!["Parity".to_string()], vec![]),
203205
Endpoint::new(
204206
"OnFinality",
205207
"wss://polkadot.api.onfinality.io:443/public-ws",
206208
vec!["OnFinality".to_string()],
209+
vec![],
207210
),
208211
],
209212
),
210213
(
211214
"Kusama".to_string(),
212-
vec![Endpoint::new("Parity", "wss://kusama-rpc.polkadot.io:443", vec!["Parity".to_string()])],
215+
vec![Endpoint::new("Parity", "wss://kusama-rpc.polkadot.io:443", vec!["Parity".to_string()], vec![])],
213216
),
214217
]);
215218

0 commit comments

Comments
 (0)