Skip to main content

GetLatestProtocolStateSnapshotRequest Access API Method

Loading...

Updated on
Oct 04, 2023

GetLatestProtocolStateSnapshotRequest Access API Method

Parameters

This method does not accept any parameters

Returns

serializedSnapshot
Loading...
Request
1
package main
2
3
import (
4
"context"
5
"encoding/json"
6
"fmt"
7
8
"github.com/onflow/flow/protobuf/go/flow/access"
9
)
10
11
func main() {
12
13
// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.
14
client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")
15
ctx := context.Background()
16
if err != nil {
17
log.Fatalf("err: %v", err)
18
}
19
20
snapshotResp, err := client.GetLatestProtocolStateSnapshot(ctx, &access.GetLatestProtocolStateSnapshotRequest{})
21
if err != nil {
22
log.Error("get latest protocol state snapshot failed: ", err)
23
} else {
24
fmt.Printf("got latest protocol state snapshot: %s\n", snapshotResp.String())
25
}
26
27
respJSON, err := json.Marshal(snapshotResp)
28
if err != nil {
29
log.Fatal("Get Latest Protocol StateSnapshot failed: ", err)
30
}
31
fmt.Println("GetLatestProtocolStateSnapshot response:", string(respJSON))
32
33
}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free