From b92fbf58800a5ca298c1b43f0aaa812aecc3046f Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Mon, 6 Dec 2021 13:49:50 +0400 Subject: [PATCH] add IsMine property to transaction --- transaction.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/transaction.go b/transaction.go index 54b8a73..0c6d627 100644 --- a/transaction.go +++ b/transaction.go @@ -29,19 +29,23 @@ type Transaction struct { Score float64 Url string TimeDescription string + IsMine bool } type TransactionService struct { graphClient *graphql.Client squadservice *SquadService floorService *FloorService + + bscaddress string } -func NewTransactionService(graphClient *graphql.Client, squadservice *SquadService, floorService *FloorService) *TransactionService { +func NewTransactionService(graphClient *graphql.Client, squadservice *SquadService, floorService *FloorService, bscaddress string) *TransactionService { return &TransactionService{ graphClient: graphClient, squadservice: squadservice, floorService: floorService, + bscaddress: bscaddress, } } @@ -101,6 +105,7 @@ func (s *TransactionService) GetLightPageByLimit(ctx context.Context, pagenumber sort.Slice(transaction.Nft.TransactionHistory, func(i, j int) bool { return transaction.Nft.TransactionHistory[i].Timestamp > transaction.Nft.TransactionHistory[j].Timestamp }) + transaction.IsMine = transaction.Buyer.Address == s.bscaddress || transaction.Seller.Address == s.bscaddress } var res []Transaction