Skip to content

Commit

Permalink
chore: using url return type (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasir Shariff authored Sep 9, 2023
1 parent a885809 commit 9ada574
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion workspaces/src/network/betanet.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use url::Url;

use crate::network::builder::{FromNetworkBuilder, NetworkBuilder};
use crate::network::{Info, NetworkClient, NetworkInfo};
use crate::rpc::client::Client;
Expand Down Expand Up @@ -36,7 +38,7 @@ impl FromNetworkBuilder for Betanet {
name: build.name.into(),
root_id: "near".parse().unwrap(),
keystore_path: PathBuf::from(".near-credentials/betanet/"),
rpc_url,
rpc_url: Url::parse(&rpc_url).expect("url is hardcoded"),
},
})
}
Expand Down
3 changes: 1 addition & 2 deletions workspaces/src/network/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub struct Info {
/// Path to the keystore directory
pub keystore_path: PathBuf,

// TODO: change return type to Url instead of String
/// Rpc endpoint to point our client to
pub rpc_url: String,
pub rpc_url: url::Url,
}
2 changes: 1 addition & 1 deletion workspaces/src/network/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl FromNetworkBuilder for Mainnet {
name: build.name.into(),
root_id: "near".parse().unwrap(),
keystore_path: PathBuf::from(".near-credentials/mainnet/"),
rpc_url,
rpc_url: url::Url::parse(&rpc_url).expect("url is hardcodeed"),
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion workspaces/src/network/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl FromNetworkBuilder for Sandbox {
name: build.name.into(),
root_id: AccountId::from_str("test.near").unwrap(),
keystore_path: PathBuf::from(".near-credentials/sandbox/"),
rpc_url: server.rpc_addr(),
rpc_url: url::Url::parse(&server.rpc_addr()).expect("url is hardcoded"),
};

Ok(Self {
Expand Down
2 changes: 1 addition & 1 deletion workspaces/src/network/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl FromNetworkBuilder for Testnet {
name: build.name.into(),
root_id: AccountId::from_str("testnet").unwrap(),
keystore_path: PathBuf::from(".near-credentials/testnet/"),
rpc_url,
rpc_url: Url::parse(&rpc_url).expect("url is hardcoded"),
},
})
}
Expand Down

0 comments on commit 9ada574

Please sign in to comment.