Skip to content

Commit

Permalink
Merge pull request #581 from tonkeeper/nftspam
Browse files Browse the repository at this point in the history
add context to NftTrust
  • Loading branch information
erokhinav authored Jan 16, 2025
2 parents c274453 + 4aff28a commit f8e83e2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/api/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ type SpamFilter interface {
CheckActions(actions []oas.Action, viewer *ton.AccountID, initiator ton.AccountID) bool
JettonTrust(address tongo.AccountID, symbol, name, image string) core.TrustType
AccountTrust(address tongo.AccountID) core.TrustType
NftTrust(address tongo.AccountID, collection *ton.AccountID, description, image string) core.TrustType
NftTrust(ctx context.Context, address tongo.AccountID, collection *ton.AccountID, description, image string) core.TrustType
}

type verifierSource interface {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/nft_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (h *Handler) convertNFT(ctx context.Context, item core.NftItem, book addres
if len(nftItem.ApprovedBy) > 0 && nftItem.Verified {
nftItem.Trust = oas.TrustType(core.TrustWhitelist)
} else {
nftItem.Trust = oas.TrustType(h.spamFilter.NftTrust(item.Address, item.CollectionAddress, description, image))
nftItem.Trust = oas.TrustType(h.spamFilter.NftTrust(ctx, item.Address, item.CollectionAddress, description, image))
}
if image == "" {
image = references.Placeholder
Expand Down
3 changes: 2 additions & 1 deletion pkg/spam/spam.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package spam

import (
"context"
"github.com/tonkeeper/opentonapi/pkg/core"
"github.com/tonkeeper/opentonapi/pkg/oas"
rules "github.com/tonkeeper/scam_backoffice_rules"
Expand Down Expand Up @@ -46,7 +47,7 @@ func (f Filter) JettonTrust(address tongo.AccountID, symbol, name, image string)
return core.TrustNone
}

func (f Filter) NftTrust(address tongo.AccountID, collection *ton.AccountID, description, image string) core.TrustType {
func (f Filter) NftTrust(ctx context.Context, address tongo.AccountID, collection *ton.AccountID, description, image string) core.TrustType {
return core.TrustNone
}

Expand Down

0 comments on commit f8e83e2

Please sign in to comment.