@@ -2,12 +2,16 @@ pub use dotenv::dotenv;
2
2
pub use std:: collections:: HashMap ;
3
3
pub use std:: { env, path:: Path , path:: PathBuf } ;
4
4
5
+ #[ allow( clippy:: unreadable_literal) ]
5
6
const MAINNET_AURORA_CHAIN_ID : i64 = 1313161554 ;
7
+ #[ allow( clippy:: unreadable_literal) ]
6
8
const TESTNET_AURORA_CHAIN_ID : i64 = 1313161555 ;
9
+ #[ allow( clippy:: unreadable_literal) ]
7
10
const SEPOLIA_CHAIN_ID : i64 = 11155111 ;
8
11
const ROPSTEN_CHAIN_ID : i64 = 3 ;
9
12
const GOERLI_CHAIN_ID : i64 = 5 ;
10
13
14
+ #[ must_use]
11
15
pub fn load_env_file ( ) -> HashMap < String , String > {
12
16
dotenv ( ) . ok ( ) ;
13
17
let env_vars: HashMap < String , String > = env:: vars ( )
@@ -16,11 +20,13 @@ pub fn load_env_file() -> HashMap<String, String> {
16
20
env_vars
17
21
}
18
22
23
+ #[ must_use]
19
24
pub fn get_env_var ( var : & str ) -> Option < String > {
20
25
let vars = load_env_file ( ) ;
21
26
Some ( vars. get ( var) ?. to_string ( ) )
22
27
}
23
28
29
+ #[ must_use]
24
30
pub fn get_full_db_path ( ) -> Option < PathBuf > {
25
31
let db_dir = "../relayer-test-data-generator/db/test-data.sqlite3" . to_string ( ) ;
26
32
Some ( Path :: join (
@@ -29,51 +35,53 @@ pub fn get_full_db_path() -> Option<PathBuf> {
29
35
) )
30
36
}
31
37
38
+ #[ must_use]
32
39
pub fn get_chain_id ( network_name : & str ) -> Option < i64 > {
33
40
match network_name {
34
41
"sepolia" => Some ( SEPOLIA_CHAIN_ID ) ,
35
42
"ropsten" => Some ( ROPSTEN_CHAIN_ID ) ,
36
43
"goerli" => Some ( GOERLI_CHAIN_ID ) ,
37
- "testnet_aurora_plus" => Some ( TESTNET_AURORA_CHAIN_ID ) ,
38
- "testnet_aurora" => Some ( TESTNET_AURORA_CHAIN_ID ) ,
39
- "mainnet_aurora_plus" => Some ( MAINNET_AURORA_CHAIN_ID ) ,
40
- "wss_mainnet_aurora_plus" => Some ( MAINNET_AURORA_CHAIN_ID ) ,
41
- "mainnet_aurora_plus_rpc_url" => Some ( MAINNET_AURORA_CHAIN_ID ) ,
42
- "new_mainnet_aurora_plus" => Some ( MAINNET_AURORA_CHAIN_ID ) ,
43
- "mainnet_aurora" => Some ( MAINNET_AURORA_CHAIN_ID ) ,
44
+ "testnet_aurora_plus" | "testnet_aurora" => Some ( TESTNET_AURORA_CHAIN_ID ) ,
45
+ "mainnet_aurora_plus"
46
+ | "wss_mainnet_aurora_plus"
47
+ | "mainnet_aurora_plus_rpc_url"
48
+ | "new_mainnet_aurora_plus"
49
+ | "mainnet_aurora" => Some ( MAINNET_AURORA_CHAIN_ID ) ,
44
50
_ => Some ( 0 ) ,
45
51
}
46
52
}
47
53
54
+ #[ must_use]
48
55
pub fn get_client_version ( network_name : & str ) -> Option < String > {
49
56
static AURORA_WEB3_CLIENT_VERSION : & str = "Aurora" ;
50
57
match network_name {
51
- "sepolia" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
52
58
"ropsten" => Some ( "erigon/2022.99.99/linux-amd64/go1.18.3" . to_string ( ) ) , // https://rpc.ankr.com/eth_ropsten
53
59
"goerli" => Some ( "Geth/v1.10.23-omnibus-b38477ec/linux-amd64/go1.18.5" . to_string ( ) ) , // infura
54
- "testnet_aurora_plus" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
55
- "testnet_aurora" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
56
- "mainnet_aurora_plus" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
57
- "wss_mainnet_aurora_plus" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
58
- "mainnet_aurora_plus_rpc_url" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
59
- "new_mainnet_aurora_plus" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
60
- "mainnet_aurora" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
61
- _ => Some ( "" . to_string ( ) ) ,
60
+ "sepolia"
61
+ | "testnet_aurora_plus"
62
+ | "testnet_aurora"
63
+ | "mainnet_aurora_plus"
64
+ | "wss_mainnet_aurora_plus"
65
+ | "mainnet_aurora_plus_rpc_url"
66
+ | "new_mainnet_aurora_plus"
67
+ | "mainnet_aurora" => Some ( AURORA_WEB3_CLIENT_VERSION . to_string ( ) ) ,
68
+ _ => Some ( String :: new ( ) ) ,
62
69
}
63
70
}
64
71
72
+ #[ must_use]
65
73
pub fn get_protocol_version ( network : & str ) -> Option < i32 > {
66
74
match network {
67
- "sepolia" => Some ( 65 ) ,
68
75
"ropsten" => Some ( 0 ) , // this one is unknown!
69
- "goerli" => Some ( 65 ) ,
70
- "testnet_aurora_plus" => Some ( 65 ) , // 0x41
71
- "testnet_aurora" => Some ( 65 ) , // 0x41
72
- "mainnet_aurora_plus" => Some ( 65 ) , // 0x41
73
- "wss_mainnet_aurora_plus" => Some ( 65 ) , // 0x41
74
- "mainnet_aurora_plus_rpc_url" => Some ( 65 ) , // 0x41
75
- "new_mainnet_aurora_plus" => Some ( 65 ) , // 0x41
76
- "mainnet_aurora" => Some ( 65 ) , // 0x41
76
+ "goerli"
77
+ | "sepolia"
78
+ | "testnet_aurora_plus"
79
+ | "testnet_aurora"
80
+ | "mainnet_aurora_plus"
81
+ | "wss_mainnet_aurora_plus"
82
+ | "mainnet_aurora_plus_rpc_url"
83
+ | "new_mainnet_aurora_plus"
84
+ | "mainnet_aurora" => Some ( 65 ) , // 0x41
77
85
_ => None ,
78
86
}
79
87
}
0 commit comments