mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
* Migrate Prysm repo to Offchain Labs organization ahead of Pectra upgrade v6 * Replace prysmaticlabs with OffchainLabs on general markdowns * Update mock * Gazelle and add mock.go to excluded generated mock file
24 lines
644 B
Go
24 lines
644 B
Go
package apiutil
|
|
|
|
import (
|
|
"fmt"
|
|
neturl "net/url"
|
|
"strconv"
|
|
|
|
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
|
)
|
|
|
|
// Uint64ToString is a util function that will convert uints to string
|
|
func Uint64ToString[T uint64 | primitives.Slot | primitives.ValidatorIndex | primitives.CommitteeIndex | primitives.Epoch](val T) string {
|
|
return strconv.FormatUint(uint64(val), 10)
|
|
}
|
|
|
|
// BuildURL is a util function that assists with adding query parameters to the url
|
|
func BuildURL(path string, queryParams ...neturl.Values) string {
|
|
if len(queryParams) == 0 {
|
|
return path
|
|
}
|
|
|
|
return fmt.Sprintf("%s?%s", path, queryParams[0].Encode())
|
|
}
|