Skip to main content

GetAccountAtLatestBlock Access API Method

Loading...

Updated on
Oct 04, 2023

GetAccountAtLatestBlock Access API Method

Parameters

Address
bytes
REQUIRED
Loading...

Returns

account
object
Loading...
address
string
Loading...
balance
integer
Loading...
keys
array
Loading...
public_key
string
Loading...
sign_algo
integer
Loading...
hash_algo
integer
Loading...
weight
integer
Loading...
sequence_number
integer
Loading...
contracts
object
Loading...
PrivateReceiverForwarder
string
Loading...
Request
1
package main
2
3
import (
4
"context"
5
"encoding/hex"
6
"encoding/json"
7
"fmt"
8
"log"
9
10
"github.com/onflow/flow/protobuf/go/flow/access"
11
)
12
13
14
func main() {
15
16
// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.
17
client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")
18
ctx := context.Background()
19
if err != nil {
20
log.Fatalf("err: %v", err)
21
}
22
23
// Get Account At Latest Block by Address
24
address, err := hex.DecodeString("18eb4ee6b3c026d2")
25
if err != nil {
26
log.Fatalf("err: %v", err)
27
}
28
accountLatestResp, err := client.GetAccountAtLatestBlock(ctx, &access.GetAccountAtLatestBlockRequest{Address: address})
29
respJSON, err := json.Marshal(accountLatestResp)
30
if err != nil {
31
log.Fatalf("err: %v", err)
32
}
33
fmt.Println("Get Account At Latest Block response:", string(respJSON))
34
}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free