Skip to content

Commit

Permalink
chg: switch blockNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
marcello33 committed Nov 13, 2024
1 parent 9cb6fca commit 927db07
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions internal/cli/server/api_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,18 @@ func (s *Server) BorBlockReceipt(ctx context.Context, req *protobor.ReceiptReque
}

func getRpcBlockNumberFromString(blockNumber string) (rpc.BlockNumber, error) {
if blockNumber == "latest" {
switch blockNumber {
case "latest":
return rpc.LatestBlockNumber, nil
}

if blockNumber == "earliest" {
case "earliest":
return rpc.EarliestBlockNumber, nil
}

if blockNumber == "pending" {
case "pending":
return rpc.PendingBlockNumber, nil
}

if blockNumber == "finalized" {
case "finalized":
return rpc.FinalizedBlockNumber, nil
}

if blockNumber == "safe" {
case "safe":
return rpc.SafeBlockNumber, nil
default:
return rpc.BlockNumber(0), errors.New("invalid block number")
}

return rpc.BlockNumber(0), errors.New("invalid block number")
}

0 comments on commit 927db07

Please sign in to comment.