Add PulseChain exit info

This commit is contained in:
Shane Bammel 2023-05-09 15:50:07 -05:00
parent b9cd981f28
commit 938133153e
2 changed files with 13 additions and 1 deletions

View File

@ -171,11 +171,15 @@ func displayExitInfo(rawExitedKeys [][]byte, trimmedExitedKeys []string) {
}
func formatBeaconChaURL(key []byte) string {
// TODO: Add URLs for PulseChain explorer.
baseURL := "https://%sbeaconcha.in/validator/%s"
pulseChainURL := "https://%s.pulsechain.com/validator/%s"
keyWithout0x := hexutil.Encode(key)[2:]
switch env := params.BeaconConfig().ConfigName; env {
case params.PulseChainName:
return fmt.Sprintf(pulseChainURL, "beacon", keyWithout0x)
case params.PulseChainTestnetV4Name:
return fmt.Sprintf(pulseChainURL, "beacon.v4.testnet", keyWithout0x)
case params.PraterName, params.GoerliName:
return fmt.Sprintf(baseURL, "prater.", keyWithout0x)
case params.HoleskyName:

View File

@ -39,6 +39,14 @@ func TestDisplayExitInfo(t *testing.T) {
params.BeaconConfig().ConfigName = params.SepoliaName
displayExitInfo([][]byte{key}, []string{string(key)})
assert.LogsContain(t, logHook, "https://sepolia.beaconcha.in/validator/3078313233343536")
params.BeaconConfig().ConfigName = params.PulseChainName
displayExitInfo([][]byte{key}, []string{string(key)})
assert.LogsContain(t, logHook, "https://beacon.pulsechain.com/validator/3078313233343536")
params.BeaconConfig().ConfigName = params.PulseChainTestnetV4Name
displayExitInfo([][]byte{key}, []string{string(key)})
assert.LogsContain(t, logHook, "https://beacon.v4.testnet.pulsechain.com/validator/3078313233343536")
}
func TestDisplayExitInfo_NoKeys(t *testing.T) {