GetLatestProtocolStateSnapshotRequest Access API Method
Parameter
Diese Methode akzeptiert keine Parameter.
Rücksendungen
serializedSnapshot
Wird geladen...
Anfrage
1Paket Hauptteil23import (4„Kontext“5"encoding/json"6„fmt“78"github.com/onflow/flow/protobuf/go/flow/access"9)1011func main() {1213// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.14client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")15ctx := context.Background()16wenn err != nil {17log.Fatalf("err: %v", err)18}1920snapshotResp, err := client.GetLatestProtocolStateSnapshot(ctx, &access.GetLatestProtocolStateSnapshotRequest{})21wenn err != nil {22log.Error("get latest protocol state snapshot failed: ", err)23} else {24fmt.Printf("got latest protocol state snapshot: %s\n", snapshotResp.String())25}2627respJSON, err := json.Marshal(snapshotResp)28wenn err != nil {29log.Fatal("Get Latest Protocol StateSnapshot failed: ", err)30}31fmt.Println("GetLatestProtocolStateSnapshot response:", string(respJSON))3233}
1Paket Hauptteil23import (4„Kontext“5"encoding/json"6„fmt“78"github.com/onflow/flow/protobuf/go/flow/access"9)1011func main() {1213// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.14client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")15ctx := context.Background()16wenn err != nil {17log.Fatalf("err: %v", err)18}1920snapshotResp, err := client.GetLatestProtocolStateSnapshot(ctx, &access.GetLatestProtocolStateSnapshotRequest{})21wenn err != nil {22log.Error("get latest protocol state snapshot failed: ", err)23} else {24fmt.Printf("got latest protocol state snapshot: %s\n", snapshotResp.String())25}2627respJSON, err := json.Marshal(snapshotResp)28wenn err != nil {29log.Fatal("Get Latest Protocol StateSnapshot failed: ", err)30}31fmt.Println("GetLatestProtocolStateSnapshot response:", string(respJSON))3233}
Haben Sie noch kein Konto?
Erstellen Sie Ihren Quicknode-Endpunkt in Sekundenschnelle und legen Sie los
Kostenlos loslegen