29 eth_rpc_endpoint: Optional[str],
30 eth_rpc_certificate: Optional[str],
31 eth_rpc_insecure: bool,
32 output_file: str) ->
None:
34 Generate a network config file. ETH_NETWORK is a network name or
35 pre-existing network config file.
40 # Write default config for "ganache" to the default file
41 $ zeth-helper eth-gen-network-config ganache
44 # Write "geth" config with a custom endpoint to default file
45 $ zeth-helper eth-gen-network-config geth \\
46 --eth-rpc-endpoint http://localhost:8080
49 # Write a custom https endpoint to file, specifying the certificate
50 $ zeth-helper eth-gen-network-config \\
52 --eth-rpc-endpoint https://rpc.my-network.io:8545 \\
53 --eth-rpc-certificate rpc.my-network.io.crt
56 # Write default network and endpoint to file "default-network"
57 $ zeth-helper eth-gen-network-config --output-file default-network
60 if eth_rpc_endpoint
is not None:
61 network = NetworkConfig(
63 endpoint=eth_rpc_endpoint,
64 certificate=eth_rpc_certificate,
65 insecure=eth_rpc_insecure)
69 network_json = network.to_json()
70 print(f
"network: {network_json}")
72 with open(output_file,
"w")
as eth_network_f:
73 eth_network_f.write(network_json)
74 print(f
"written to \"{output_file}\"")