add IsMine property to transaction

This commit is contained in:
Laurent Le Houerou 2021-12-06 13:49:50 +04:00
parent 38b90fa65c
commit b92fbf5880

View File

@ -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