diff --git a/pkg/api/event_converters.go b/pkg/api/event_converters.go index e342378a..44e78291 100644 --- a/pkg/api/event_converters.go +++ b/pkg/api/event_converters.go @@ -68,7 +68,7 @@ func (h *Handler) convertRisk(ctx context.Context, risk wallet.Risk, walletAddre Nfts: nil, } for jetton, quantity := range risk.Jettons { - jettonWallets, err := h.storage.GetJettonWalletsByOwnerAddress(ctx, walletAddress, &jetton, true) + jettonWallets, err := h.storage.GetJettonWalletsByOwnerAddress(ctx, walletAddress, &jetton, false, true) if err != nil || len(jettonWallets) == 0 { continue } diff --git a/pkg/api/interfaces.go b/pkg/api/interfaces.go index b68a36b2..ed4a7ba4 100644 --- a/pkg/api/interfaces.go +++ b/pkg/api/interfaces.go @@ -70,7 +70,7 @@ type storage interface { FindAllDomainsResolvedToAddress(ctx context.Context, a tongo.AccountID, collections map[tongo.AccountID]string) ([]string, error) - GetJettonWalletsByOwnerAddress(ctx context.Context, address tongo.AccountID, jetton *tongo.AccountID, mintless bool) ([]core.JettonWallet, error) + GetJettonWalletsByOwnerAddress(ctx context.Context, address tongo.AccountID, jetton *tongo.AccountID, isJettonMaster bool, mintless bool) ([]core.JettonWallet, error) GetJettonsHoldersCount(ctx context.Context, accounts []tongo.AccountID) (map[tongo.AccountID]int32, error) GetJettonHolders(ctx context.Context, jettonMaster tongo.AccountID, limit, offset int) ([]core.JettonHolder, error) GetJettonMasterMetadata(ctx context.Context, master tongo.AccountID) (tongo.JettonMetadata, error) diff --git a/pkg/api/jetton_handlers.go b/pkg/api/jetton_handlers.go index 6aa0fa01..3490bd45 100644 --- a/pkg/api/jetton_handlers.go +++ b/pkg/api/jetton_handlers.go @@ -20,7 +20,7 @@ func (h *Handler) GetAccountJettonsBalances(ctx context.Context, params oas.GetA if err != nil { return nil, toError(http.StatusBadRequest, err) } - wallets, err := h.storage.GetJettonWalletsByOwnerAddress(ctx, account.ID, nil, slices.Contains(params.SupportedExtensions, "custom_payload")) + wallets, err := h.storage.GetJettonWalletsByOwnerAddress(ctx, account.ID, nil, true, slices.Contains(params.SupportedExtensions, "custom_payload")) if errors.Is(err, core.ErrEntityNotFound) { return &oas.JettonsBalances{}, nil } @@ -49,7 +49,7 @@ func (h *Handler) GetAccountJettonBalance(ctx context.Context, params oas.GetAcc if err != nil { return nil, toError(http.StatusBadRequest, err) } - wallets, err := h.storage.GetJettonWalletsByOwnerAddress(ctx, account.ID, &jettonAccount.ID, slices.Contains(params.SupportedExtensions, "custom_payload")) + wallets, err := h.storage.GetJettonWalletsByOwnerAddress(ctx, account.ID, &jettonAccount.ID, true, slices.Contains(params.SupportedExtensions, "custom_payload")) if errors.Is(err, core.ErrEntityNotFound) { return nil, toError(http.StatusNotFound, err) } diff --git a/pkg/litestorage/jetton.go b/pkg/litestorage/jetton.go index 819fb48d..edcb950d 100644 --- a/pkg/litestorage/jetton.go +++ b/pkg/litestorage/jetton.go @@ -16,7 +16,7 @@ import ( "github.com/tonkeeper/tongo/ton" ) -func (s *LiteStorage) GetJettonWalletsByOwnerAddress(ctx context.Context, address ton.AccountID, jetton *ton.AccountID, mintless bool) ([]core.JettonWallet, error) { +func (s *LiteStorage) GetJettonWalletsByOwnerAddress(ctx context.Context, address ton.AccountID, jetton *ton.AccountID, isJettonMaster bool, mintless bool) ([]core.JettonWallet, error) { timer := prometheus.NewTimer(prometheus.ObserverFunc(func(v float64) { storageTimeHistogramVec.WithLabelValues("get_jetton_wallets_by_owner").Observe(v) }))