1use crate::account::Account;
4use crate::agent::Agent;
5use crate::{DEFAULT_BASE_URL, DEFAULT_TESTNET};
6
7#[derive(Clone)]
8pub struct AgentBuilder {
9 url: String,
10 network: String,
11 account: Account,
12}
13
14impl Default for AgentBuilder {
15 fn default() -> Self {
16 AgentBuilder {
17 url: DEFAULT_BASE_URL.to_string(),
18 network: DEFAULT_TESTNET.to_string(),
19 account: Account::default(),
20 }
21 }
22}
23
24impl AgentBuilder {
25 pub fn build(self) -> Agent {
26 Agent::new(self.url, self.network, self.account)
27 }
28
29 pub fn with_url<S: Into<String>>(mut self, url: S) -> Self {
30 self.url = url.into();
31 self
32 }
33
34 pub fn with_network<S: Into<String>>(mut self, network: S) -> Self {
35 self.network = network.into();
36 self
37 }
38
39 pub fn with_account(mut self, account: Account) -> Self {
40 self.account = account;
41 self
42 }
43}