Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Emulator gRPC host for default access URL and update event types to EVM #21

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ import (
)

const (
accessURL = "access-001.devnet49.nodes.onflow.org:9000"
coinbaseAddr = "0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb"
defaultAccessURL = grpc.EmulatorHost
coinbaseAddr = "0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb"
)

// TODO(m-Peter): These should be updates to the EVM location,
// as soon as it gets merged.
var evmEventTypes = []string{
"flow.evm.BlockExecuted",
Copy link
Contributor

@sideninja sideninja Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about using:

evm := types.EVMLocation{}
evm.TypeID(nil, string(types.EventTypeTransactionExecuted))
evm.TypeID(nil, string(types.EventTypeBlockExecuted))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 👍 , I will update them as soon as we add flow-go as a dependency. Right now it's not there yet, due to some dependency conflicts with flow-go-sdk I think. I have added a TODO and will update it though.

"flow.evm.TransactionExecuted",
}

func main() {
var network, coinbase string

Expand Down Expand Up @@ -54,7 +61,7 @@ func main() {

func runIndexer(ctx context.Context, store *storage.Store, logger zerolog.Logger) {
flowClient, err := grpc.NewBaseClient(
accessURL,
defaultAccessURL,
goGrpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
Expand All @@ -79,7 +86,7 @@ func runIndexer(ctx context.Context, store *storage.Store, logger zerolog.Logger

var err error
flowClient, err := grpc.NewBaseClient(
accessURL,
defaultAccessURL,
goGrpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
Expand All @@ -90,7 +97,7 @@ func runIndexer(ctx context.Context, store *storage.Store, logger zerolog.Logger
ctx,
latestBlockHeader.Height,
flow.EventFilter{
Contracts: []string{"A.7e60df042a9c0868.FlowToken"},
EventTypes: evmEventTypes,
},
grpc.WithHeartbeatInterval(1),
)
Expand Down Expand Up @@ -130,7 +137,7 @@ func runIndexer(ctx context.Context, store *storage.Store, logger zerolog.Logger
store.StoreBlockHeight(ctx, response.Height)
}
for _, event := range response.Events {
logger.Info().Msgf(" %s", event.Type)
logger.Info().Msgf(" %s", event.Value)
}

lastHeight = response.Height
Expand Down
Loading