Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add context to NftTrust #581

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading