From e9bb8850a64a4b6b8f31e7550913743656ed9044 Mon Sep 17 00:00:00 2001 From: yusufyian Date: Sun, 7 Jul 2024 12:23:45 +0000 Subject: [PATCH] feat: Enable retrieval of the last block in SolanaClient --- hypergrid-aide/tools/solana.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hypergrid-aide/tools/solana.go b/hypergrid-aide/tools/solana.go index 25cbcb9..aeaeccb 100644 --- a/hypergrid-aide/tools/solana.go +++ b/hypergrid-aide/tools/solana.go @@ -63,6 +63,17 @@ func (s *SolanaClient) GetFirstBlock() (uint64, error) { return 0, nil } +func (s *SolanaClient) GetLastBlock() (uint64, error) { + // resp, err := s.Client.GetBlock() .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)