Skip to content

Commit

Permalink
Merge pull request #523 from tonkeeper/get_jetton_wallet_fix
Browse files Browse the repository at this point in the history
add isJettonMaster param
  • Loading branch information
mr-tron authored Nov 6, 2024
2 parents 8090e5e + bf20154 commit c8459f5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/api/event_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/jetton_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/litestorage/jetton.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}))
Expand Down

0 comments on commit c8459f5

Please sign in to comment.