Skip to content

Commit

Permalink
fix: consolidate futurenet definitions to static method
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Jul 19, 2023
1 parent 3211e09 commit 2484305
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
5 changes: 1 addition & 4 deletions cmd/soroban-cli/src/commands/config/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,7 @@ impl Args {
let res = KeyType::Network.read_with_global(name, &self.local_config()?);
if let Err(Error::ConfigMissing(_, _)) = &res {
if name == "futurenet" {
let network = Network {
rpc_url: "https://rpc-futurenet.stellar.org/soroban/rpc".to_string(),
network_passphrase: "Test SDF Future Network ; October 2022".to_string(),
};
let network = Network::futurenet();
self.write_network(name, &network)?;
return Ok(network);
}
Expand Down
9 changes: 9 additions & 0 deletions cmd/soroban-cli/src/commands/config/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,12 @@ pub struct Network {
)]
pub network_passphrase: String,
}

impl Network {
pub fn futurenet() -> Self {
Network {
rpc_url: "https://rpc-futurenet.stellar.org:443".to_owned(),
network_passphrase: "Test SDF Future Network ; October 2022".to_owned(),
}
}
}
9 changes: 5 additions & 4 deletions cmd/soroban-cli/src/commands/contract/bindings/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ impl Cmd {
let Network {
rpc_url,
network_passphrase,
} = self.network.get(&self.locator).unwrap_or(Network {
rpc_url: "https://rpc-futurenet.stellar.org:443/soroban/rpc".to_string(),
network_passphrase: "Test SDF Future Network ; October 2022".to_string(),
});
} = self
.network
.get(&self.locator)
.ok()
.unwrap_or_else(Network::futurenet);
p.init(
&self.contract_name,
&self.contract_id,
Expand Down

0 comments on commit 2484305

Please sign in to comment.