Skip to content

Commit 62b18fa

Browse files
Added Default impl for Node struct
1 parent 0d3376a commit 62b18fa

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/node.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1+
/// Module with a set of node answer struct
12
pub mod response;
23

34
use response::*;
45

6+
/// Mainnet node REST API
57
pub const MAINNET_URL: &str = "https://nodes.wavesnodes.com";
8+
/// Testnet node REST API
69
pub const TESTNET_URL: &str = "https://nodes-testnet.wavesnodes.com";
10+
/// Stagenet node REST API
711
pub const STAGENET_URL: &str = "https://nodes-stagenet.wavesnodes.com";
12+
/// Local node REST API
813
pub const LOCAL_URL: &str = "http://127.0.0.1:6869";
914

15+
/// [`Node`] client for executing asynchronous requests.
16+
///
17+
/// [`Node`] client has url as the configuration value, but the default is set to what is usually the most commonly desired value. Use [`Node::from_url()`] to create the node client.
1018
pub struct Node<'a> {
1119
url: &'a str,
1220
}
1321

22+
impl<'a> Default for Node<'a> {
23+
fn default() -> Self {
24+
Node { url: MAINNET_URL }
25+
}
26+
}
27+
1428
impl<'a> Node<'a> {
29+
/// Create an [`Node`] from url string.
1530
pub fn from_url(url: &'a str) -> Self {
1631
Node { url }
1732
}

0 commit comments

Comments
 (0)