forked from cerc-io/plugeth
cmd/faucet: add sepolia network support (#25128)
cmd/faucet: Add Sepolia network support to faucet
This commit is contained in:
parent
d39f0cce71
commit
ad15050c7f
@ -10,9 +10,10 @@ The `faucet` is a single binary app (everything included) with all configuration
|
|||||||
|
|
||||||
First thing's first, the `faucet` needs to connect to an Ethereum network, for which it needs the necessary genesis and network infos. Each of the following flags must be set:
|
First thing's first, the `faucet` needs to connect to an Ethereum network, for which it needs the necessary genesis and network infos. Each of the following flags must be set:
|
||||||
|
|
||||||
- `-genesis` is a path to a file containin the network `genesis.json`. or using:
|
- `-genesis` is a path to a file containing the network `genesis.json`. or using:
|
||||||
- `-goerli` with the faucet with Görli network config
|
- `-goerli` with the faucet with Görli network config
|
||||||
- `-rinkeby` with the faucet with Rinkeby network config
|
- `-rinkeby` with the faucet with Rinkeby network config
|
||||||
|
- `-sepolia` with the faucet with Sepolia network config
|
||||||
- `-network` is the devp2p network id used during connection
|
- `-network` is the devp2p network id used during connection
|
||||||
- `-bootnodes` is a list of `enode://` ids to join the network through
|
- `-bootnodes` is a list of `enode://` ids to join the network through
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ var (
|
|||||||
|
|
||||||
goerliFlag = flag.Bool("goerli", false, "Initializes the faucet with Görli network config")
|
goerliFlag = flag.Bool("goerli", false, "Initializes the faucet with Görli network config")
|
||||||
rinkebyFlag = flag.Bool("rinkeby", false, "Initializes the faucet with Rinkeby network config")
|
rinkebyFlag = flag.Bool("rinkeby", false, "Initializes the faucet with Rinkeby network config")
|
||||||
|
sepoliaFlag = flag.Bool("sepolia", false, "Initializes the faucet with Sepolia network config")
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -143,7 +144,7 @@ func main() {
|
|||||||
log.Crit("Failed to render the faucet template", "err", err)
|
log.Crit("Failed to render the faucet template", "err", err)
|
||||||
}
|
}
|
||||||
// Load and parse the genesis block requested by the user
|
// Load and parse the genesis block requested by the user
|
||||||
genesis, err := getGenesis(*genesisFlag, *goerliFlag, *rinkebyFlag)
|
genesis, err := getGenesis(*genesisFlag, *goerliFlag, *rinkebyFlag, *sepoliaFlag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Crit("Failed to parse genesis config", "err", err)
|
log.Crit("Failed to parse genesis config", "err", err)
|
||||||
}
|
}
|
||||||
@ -882,7 +883,7 @@ func authNoAuth(url string) (string, string, common.Address, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getGenesis returns a genesis based on input args
|
// getGenesis returns a genesis based on input args
|
||||||
func getGenesis(genesisFlag string, goerliFlag bool, rinkebyFlag bool) (*core.Genesis, error) {
|
func getGenesis(genesisFlag string, goerliFlag bool, rinkebyFlag bool, sepoliaFlag bool) (*core.Genesis, error) {
|
||||||
switch {
|
switch {
|
||||||
case genesisFlag != "":
|
case genesisFlag != "":
|
||||||
var genesis core.Genesis
|
var genesis core.Genesis
|
||||||
@ -892,6 +893,8 @@ func getGenesis(genesisFlag string, goerliFlag bool, rinkebyFlag bool) (*core.Ge
|
|||||||
return core.DefaultGoerliGenesisBlock(), nil
|
return core.DefaultGoerliGenesisBlock(), nil
|
||||||
case rinkebyFlag:
|
case rinkebyFlag:
|
||||||
return core.DefaultRinkebyGenesisBlock(), nil
|
return core.DefaultRinkebyGenesisBlock(), nil
|
||||||
|
case sepoliaFlag:
|
||||||
|
return core.DefaultSepoliaGenesisBlock(), nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("no genesis flag provided")
|
return nil, fmt.Errorf("no genesis flag provided")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user