From fc233f85f10d10d573a076c165966f4e43d9ca14 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Sat, 9 Jul 2022 17:58:16 -0700 Subject: [PATCH] #4433: added interfaces for transactxion and account data access --- exp/lighthorizon/services/main.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/exp/lighthorizon/services/main.go b/exp/lighthorizon/services/main.go index fa8160f69a..f7dd3a4e01 100644 --- a/exp/lighthorizon/services/main.go +++ b/exp/lighthorizon/services/main.go @@ -15,11 +15,23 @@ import ( ) type LightHorizon struct { - Archive archive.Archive + AccountService, + TransactionService, + Archive archive.Archive Passphrase string IndexStore index.Store } +type AccountService interface { + GetOperationsByAccount(ctx context.Context, cursor int64, limit int64, accountId string) ([]common.Operation, error) + GetOperations(ctx context.Context, cursor int64, limit int64) ([]common.Operation, error) +} + +type TransactionService interface { + GetTransactionsByAccount(ctx context.Context, cursor int64, limit int64, accountId string) ([]common.Transaction, error) + GetTransactions(ctx context.Context, cursor int64, limit int64) ([]common.Transaction, error) +} + func (lh *LightHorizon) GetOperationsByAccount(ctx context.Context, cursor int64, limit int64, accountId string) ([]common.Operation, error) { ops := []common.Operation{} // Skip the cursor ahead to the next active checkpoint for this account