GetEventsForBlockIDs Access API Method
参数
类型
字符串
必填
正在加载...
BlockIds
bytes
必填
正在加载...
退货
结果
数组
正在加载...
block_id
字符串
正在加载...
block_height
整数
正在加载...
block_timestamp
对象
正在加载...
seconds
整数
正在加载...
nanos
整数
正在加载...
请求
1包 main23导入 (4"上下文"5"编码/十六进制"6"encoding/json"7"fmt"8"日志"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()18如果 err != nil {19log.Fatalf("err: %v", err)20}2122// Get Events For HeightRange23eventType := "A.7cc345e1a0fc4283.JoyrideGameShim.FinalizeTransaction"2425blockID1, err := hex.DecodeString("32e10a29b636e6c226183779ef4f8292975af0a6c3c6762c44c9da2c99a38953")26如果 err != nil {27log.Fatalf("err: %v", err)28}2930blockID2, err := hex.DecodeString("33be7f692135e102f16d654adf8ea65b969b706eca9f8d3b3feb46b62884c871")31如果 err != nil {32log.Fatalf("err: %v", err)33}3435blockIds := [][]byte{blockID1, blockID2}3637eventsResp, err := client.GetEventsForBlockIDs(ctx, &access.GetEventsForBlockIDsRequest{Type: eventType, BlockIds: blockIds})38如果 err != nil {39log.Fatal("get events for block IDs failed: ", err)40}41respJSON, err := json.Marshal(eventsResp)42如果 err != nil {43log.Fatal("get events for block IDs failed: ", err)44}45fmt.Println("GetEventsForBlockIDs response:", string(respJSON))4647}
1包 main23导入 (4"上下文"5"编码/十六进制"6"encoding/json"7"fmt"8"日志"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()18如果 err != nil {19log.Fatalf("err: %v", err)20}2122// Get Events For HeightRange23eventType := "A.7cc345e1a0fc4283.JoyrideGameShim.FinalizeTransaction"2425blockID1, err := hex.DecodeString("32e10a29b636e6c226183779ef4f8292975af0a6c3c6762c44c9da2c99a38953")26如果 err != nil {27log.Fatalf("err: %v", err)28}2930blockID2, err := hex.DecodeString("33be7f692135e102f16d654adf8ea65b969b706eca9f8d3b3feb46b62884c871")31如果 err != nil {32log.Fatalf("err: %v", err)33}3435blockIds := [][]byte{blockID1, blockID2}3637eventsResp, err := client.GetEventsForBlockIDs(ctx, &access.GetEventsForBlockIDsRequest{Type: eventType, BlockIds: blockIds})38如果 err != nil {39log.Fatal("get events for block IDs failed: ", err)40}41respJSON, err := json.Marshal(eventsResp)42如果 err != nil {43log.Fatal("get events for block IDs failed: ", err)44}45fmt.Println("GetEventsForBlockIDs response:", string(respJSON))4647}