GetEventsForBlockIDs Access API Method
Parameters
Type
string
REQUIRED
The type of event
BlockIds
bytes
REQUIRED
The blockids for which the events is to be retrieved
Returns
results
array
A list of events
block_id
string
The ID of the block that contains the event
block_height
integer
The height of the block that contains the event
block_timestamp
object
The details of the block's timestamp, including the following properties:
seconds
integer
The seconds component of the timestamp
nanos
integer
The nanoseconds component of the timestamp
Request
1package main23import (4"context"5"encoding/hex"6"encoding/json"7"fmt"8"log"910"github.com/onflow/flow/protobuf/go/flow/access"11)1213func main() {1415// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.16client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")17ctx := context.Background()18if err != null {19log.Fatalf("err: %v", err)20}2122// Get Events For HeightRange23eventType := "A.7cc345e1a0fc4283.JoyrideGameShim.FinalizeTransaction"2425blockID1, err := hex.DecodeString("32e10a29b636e6c226183779ef4f8292975af0a6c3c6762c44c9da2c99a38953")26if err != null {27log.Fatalf("err: %v", err)28}2930blockID2, err := hex.DecodeString("33be7f692135e102f16d654adf8ea65b969b706eca9f8d3b3feb46b62884c871")31if err != null {32log.Fatalf("err: %v", err)33}3435blockIds := [][]byte{blockID1, blockID2}3637eventsResp, err := client.GetEventsForBlockIDs(ctx, &access.GetEventsForBlockIDsRequest{Type: eventType, BlockIds: blockIds})38if err != null {39log.Fatal("get events for block IDs failed: ", err)40}41respJSON, err := json.Marshal(eventsResp)42if err != null {43log.Fatal("get events for block IDs failed: ", err)44}45fmt.Println("GetEventsForBlockIDs response:", string(respJSON))4647}
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free