-
Notifications
You must be signed in to change notification settings - Fork 80
/
get_confirmed_block.go
34 lines (31 loc) · 1.2 KB
/
get_confirmed_block.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package rpc
import "context"
type GetConfirmBlockResponse struct {
Blockhash string `json:"blockhash"`
PreviousBlockhash string `json:"previousBlockhash"`
ParentSLot uint64 `json:"parentSlot"`
BlockTime int64 `json:"blockTime"`
Transactions []struct {
Meta TransactionMeta `json:"meta"`
Transaction Transaction `json:"transaction"`
} `json:"transactions"`
Rewards []struct {
Pubkey string `json:"pubkey"`
Lamports int64 `json:"lamports"`
PostBalance uint64 `json:"postBalance"`
RewardType string `json:"rewardType"` // type of reward: "fee", "rent", "voting", "staking"
} `json:"rewards"`
}
// DEPRECATED: Please use getBlock instead This method is expected to be removed in solana-core v1.8
// GetConfirmedBlock returns identity and transaction information about a confirmed block in the ledger
func (s *RpcClient) GetConfirmedBlock(ctx context.Context, slot uint64) (GetConfirmBlockResponse, error) {
res := struct {
GeneralResponse
Result GetConfirmBlockResponse `json:"result"`
}{}
err := s.request(ctx, "getConfirmedBlock", []interface{}{slot, "json"}, &res)
if err != nil {
return GetConfirmBlockResponse{}, err
}
return res.Result, nil
}