GetAccountAtBlockHeight Access API Method
參數
地址
bytes
必填
載入中...
BlockHeight
整數
必填
載入中...
退貨
account
物件
載入中...
地址
字串
載入中...
平衡
整數
載入中...
keys
陣列
載入中...
public_key
字串
載入中...
sign_algo
整數
載入中...
hash_algo
整數
載入中...
重量
整數
載入中...
sequence_number
整數
載入中...
合約
物件
載入中...
PrivateReceiverForwarder
字串
載入中...
請求
1套件 主函式23匯入 (4"上下文"5"編碼/十六進位"6"encoding/json"7"fmt"8"log"910"github.com/onflow/flow/protobuf/go/flow/access"11)121314func main() {1516// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.17client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")18ctx := context.Background()19如果 err != nil {20log.Fatalf("err: %v", err)21}2223// get latest (sealed) block24latestResp, err := client.GetLatestBlock(ctx, &access.GetLatestBlockRequest{IsSealed: true})25如果 err != nil {26log.Fatal("get latest block failed: ", err)27}2829// Get Account At Block Height30height := latestResp.Block.Height - 10031address, err := hex.DecodeString("18eb4ee6b3c026d2")32如果 err != nil {33log.Fatalf("err: %v", err)34}35accountHeightResp, err := client.GetAccountAtBlockHeight(ctx, &access.GetAccountAtBlockHeightRequest{Address: address, BlockHeight: height})36respJSON, err := json.Marshal(accountHeightResp)37如果 err != nil {38log.Fatalf("err: %v", err)39}40fmt.Println("Get Account At Block Height response:", string(respJSON))41}
1套件 主函式23匯入 (4"上下文"5"編碼/十六進位"6"encoding/json"7"fmt"8"log"910"github.com/onflow/flow/protobuf/go/flow/access"11)121314func main() {1516// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.17client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")18ctx := context.Background()19如果 err != nil {20log.Fatalf("err: %v", err)21}2223// get latest (sealed) block24latestResp, err := client.GetLatestBlock(ctx, &access.GetLatestBlockRequest{IsSealed: true})25如果 err != nil {26log.Fatal("get latest block failed: ", err)27}2829// Get Account At Block Height30height := latestResp.Block.Height - 10031address, err := hex.DecodeString("18eb4ee6b3c026d2")32如果 err != nil {33log.Fatalf("err: %v", err)34}35accountHeightResp, err := client.GetAccountAtBlockHeight(ctx, &access.GetAccountAtBlockHeightRequest{Address: address, BlockHeight: height})36respJSON, err := json.Marshal(accountHeightResp)37如果 err != nil {38log.Fatalf("err: %v", err)39}40fmt.Println("Get Account At Block Height response:", string(respJSON))41}