Skip to content

Commit b90b98f

Browse files
committed
fix none/wrong elements added to the history
1 parent ef65134 commit b90b98f

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

internal/nemo/provider/pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (pp *Pool) IsContract(address common.Address) bool {
252252
// ok 🙄 seems we really need to check via a node if its a eoa or contract
253253
codeAt, err := pp.GetCodeAt(context.Background(), address)
254254
if err != nil {
255-
gbl.Log.Errorf("❗️ failed to get codeAt for %s: %s", address.String(), err)
255+
gbl.Log.Debugf("❕ failed to get codeAt for %s: %s", address.String(), err)
256256

257257
return false
258258
}

internal/nemo/totra/totra.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func (ttx *TokenTransaction) GetPurchaseOrBidIndicator() string {
348348
var purchaseOrBidStyle lipgloss.Style
349349

350350
switch {
351-
case ttx.IsItemBid():
351+
case ttx.IsAcceptedOffer():
352352
purchaseOrBidStyle = style.TrendRedStyle
353353

354354
case ttx.IsListing():
@@ -369,6 +369,7 @@ func (ttx *TokenTransaction) GetPurchaseOrBidIndicator() string {
369369

370370
func (ttx *TokenTransaction) Is() map[string]bool {
371371
isFunctions := map[string]bool{
372+
"IsAcceptedOffer": ttx.IsAcceptedOffer(),
372373
"IsAirdrop": ttx.IsAirdrop(),
373374
"IsBurn": ttx.IsBurn(),
374375
"IsCollectionOffer": ttx.IsCollectionOffer(),
@@ -411,6 +412,10 @@ func (ttx *TokenTransaction) IsListing() bool {
411412
}
412413

413414
func (ttx *TokenTransaction) IsItemBid() bool {
415+
return ttx.Action == degendb.Bid
416+
}
417+
418+
func (ttx *TokenTransaction) IsAcceptedOffer() bool {
414419
return ttx.GetNFTSenderAddresses().Cardinality() > 0 && ttx.GetNFTSenderAddresses().Contains(ttx.From)
415420
}
416421

internal/trapri/trapri.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,6 @@ func formatTokenTransaction(gb *gloomberg.Gloomberg, seawa *seawatcher.SeaWatche
974974
//
975975
// 🌈 finally print the sale/listing/whatever 🌈
976976
if !viper.GetBool("ui.headless") {
977-
// terminalPrinterQueue <- out.String()
978977
if ttx.IsListing() && !isOwnCollection {
979978
return
980979
}
@@ -986,17 +985,14 @@ func formatTokenTransaction(gb *gloomberg.Gloomberg, seawa *seawatcher.SeaWatche
986985
}
987986

988987
// print to terminal
989-
// gb.In.PrintToTerminal <- printLine
990988
gloomberg.TerminalPrinterQueue <- printLine
991989

992990
gb.In.ParsedEvents <- &parsedEvent
993991
}
994992

995993
// add to history
996-
if isOwn && (!ttx.IsLoan() && !ttx.IsItemBid()) { // && ttx.Action != degendb.ItemBid && ttx.Action != degendb.CollectionOffer {
997-
if (!ttx.IsListing() || (ttx.IsListing() && isOwnWallet)) && currentCollection.Source != collections.FromConfiguration && gb.Stats != nil {
998-
// gb.Stats.EventHistory = append(gb.Stats.EventHistory, ttx.AsHistoryTokenTransaction(currentCollection, fmtTokensHistory))
999-
994+
if isOwn && (!ttx.IsLoan() && !ttx.IsItemBid() && !ttx.IsCollectionOffer()) {
995+
if !ttx.IsListing() || (isOwnWallet && currentCollection.Source != collections.FromConfiguration) { // && gb.Stats != nil {
1000996
// TODO: fix/remove this...
1001997
parsedEvent.Other["fmtTokensHistory"] = fmtTokensHistory
1002998

@@ -1014,6 +1010,8 @@ func formatTokenTransaction(gb *gloomberg.Gloomberg, seawa *seawatcher.SeaWatche
10141010
}
10151011

10161012
gbl.Log.Debugf("trapri added event to history: %+v", gb.RecentOwnEvents.Cardinality())
1013+
} else {
1014+
gbl.Log.Debugf("trapri not adding event to history: %+v", ttx)
10171015
}
10181016
}
10191017
}

0 commit comments

Comments
 (0)