GetEventsForHeightRange Access API Method
參數
類型
字串
必填
載入中...
StartHeight
整數
必填
載入中...
EndHeight
整數
必填
載入中...
退貨
結果
陣列
載入中...
block_id
字串
載入中...
block_height
整數
載入中...
block_timestamp
物件
載入中...
seconds
整數
載入中...
nanos
整數
載入中...
請求
1package main23import (4"context"5"encoding/json"6"fmt"7"log"89"github.com/onflow/flow/protobuf/go/flow/access"10)1112func main() {1314// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.15client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")16ctx := context.Background()17if err != nil {18log.Fatalf("err: %v", err)19}2021// Get Events For HeightRange22eventType := "A.7cc345e1a0fc4283.JoyrideGameShim.FinalizeTransaction"2324eventsResp, err := client.GetEventsForHeightRange(ctx, &access.GetEventsForHeightRangeRequest{Type: eventType, StartHeight: 54707711, EndHeight: 54707811})25if err != nil {26log.Fatal("Get Events For HeightRange failed: ", err)27}28respJSON, err := json.Marshal(eventsResp)29if err != nil {30log.Fatal("err: ", err)31}32fmt.Println("GetEventsForHeightRange response:", string(respJSON))3334}35
1package main23import (4"context"5"encoding/json"6"fmt"7"log"89"github.com/onflow/flow/protobuf/go/flow/access"10)1112func main() {1314// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.15client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")16ctx := context.Background()17if err != nil {18log.Fatalf("err: %v", err)19}2021// Get Events For HeightRange22eventType := "A.7cc345e1a0fc4283.JoyrideGameShim.FinalizeTransaction"2324eventsResp, err := client.GetEventsForHeightRange(ctx, &access.GetEventsForHeightRangeRequest{Type: eventType, StartHeight: 54707711, EndHeight: 54707811})25if err != nil {26log.Fatal("Get Events For HeightRange failed: ", err)27}28respJSON, err := json.Marshal(eventsResp)29if err != nil {30log.Fatal("err: ", err)31}32fmt.Println("GetEventsForHeightRange response:", string(respJSON))3334}35