Skip to content

Commit

Permalink
Merge pull request #19 from mirrorworld-universe/aide
Browse files Browse the repository at this point in the history
feat: Add GetFirstBlock method to SolanaClient
  • Loading branch information
yusufyian authored Jul 7, 2024
2 parents d6210ce + af918d4 commit 882a38c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hypergrid-aide/tools/solana.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ func (s *SolanaClient) GetIdentity() (*rpc.GetIdentityResult, error) {
return s.Client.GetIdentity(context.TODO())
}

func (s *SolanaClient) GetFirstBlock() (uint64, error) {
resp, err := s.Client.GetBlocksWithLimit(context.TODO(), 0, 1, rpc.CommitmentFinalized)
if err != nil {
return 0, err
}
if len(*resp) > 0 {
return (*resp)[0], nil
}
return 0, nil
}

func (s *SolanaClient) GetBlocks(start_slot uint64, limit uint64) ([]SolanaBlock, error) {
println("GetBlocks start_slot: ", start_slot)
resp, err := s.Client.GetBlocksWithLimit(context.TODO(), start_slot, limit, rpc.CommitmentFinalized)
Expand Down

0 comments on commit 882a38c

Please sign in to comment.