Skip to content

Commit

Permalink
feat: implement enum buildertype
Browse files Browse the repository at this point in the history
  • Loading branch information
datluongductuan committed Dec 16, 2024
1 parent e08b03f commit 2419ba0
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions pkg/mev/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,53 @@ const (
BundleSenderTypeMerkle
)

func (b BundleSenderType) String() string {
return [...]string{
"unknown", // 0
"flashbot", // 1
"beaver", // 2
"rsync", // 3
"titan", // 4
"bloxroute", // 5
"all", // 6
"mevshare", // 7
"backrun_public", // 8
"mev_blocker", // 9
"blink", // 10
"merkle", // 11
}[b]
}

// BundleSenderTypeFromString Convert string back to BundleSenderType

Check failure on line 55 in pkg/mev/pkg.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

Comment should end in a period (godot)
func BundleSenderTypeFromString(s string) BundleSenderType {
switch s {
case "flashbot":
return BundleSenderTypeFlashbot
case "beaver":
return BundleSenderTypeBeaver
case "rsync":
return BundleSenderTypeRsync
case "titan":
return BundleSenderTypeTitan
case "bloxroute":
return BundleSenderTypeBloxroute
case "all":
return BundleSenderTypeAll
case "mevshare":
return BundleSenderTypeMevShare
case "backrun_public":
return BundleSenderTypeBackrunPublic
case "mev_blocker":
return BundleSenderTypeMevBlocker
case "blink":
return BundleSenderTypeBlink
case "merkle":
return BundleSenderTypeMerkle
default:
return BundleSenderType(0) // unknown
}
}

const (
JSONRPC2 = "2.0"
GetBundleStatsID = 1
Expand Down

0 comments on commit 2419ba0

Please sign in to comment.