Skip to content

Commit

Permalink
fix the GetJettonInfo method
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhar-petukhov committed Dec 13, 2024
1 parent 2b80bc5 commit 9c9a599
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions pkg/api/jetton_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,20 @@ func (h *Handler) GetJettonInfo(ctx context.Context, params oas.GetJettonInfoPar
if err != nil {
return nil, toError(http.StatusBadRequest, err)
}
meta := h.GetJettonNormalizedMetadata(ctx, account.ID)
metadata := jettonMetadata(account.ID, meta)
data, err := h.storage.GetJettonMasterData(ctx, account.ID)
master, err := h.storage.GetJettonMasterData(ctx, account.ID)
if errors.Is(err, core.ErrEntityNotFound) {
return nil, toError(http.StatusNotFound, err)
}
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
holdersCount, err := h.storage.GetJettonsHoldersCount(ctx, []tongo.AccountID{account.ID})
holders, err := h.storage.GetJettonsHoldersCount(ctx, []tongo.AccountID{account.ID})
if err != nil {
return nil, toError(http.StatusInternalServerError, err)
}
return &oas.JettonInfo{
Mintable: data.Mintable,
TotalSupply: data.TotalSupply.String(),
Metadata: metadata,
Verification: oas.JettonVerificationType(meta.Verification),
HoldersCount: holdersCount[account.ID],
Admin: convertOptAccountAddress(data.Admin, h.addressBook),
}, nil
score, _ := h.score.GetJettonScore(account.ID)
converted := h.convertJettonInfo(ctx, master, holders, score)
return &converted, nil
}

func (h *Handler) GetAccountJettonsHistory(ctx context.Context, params oas.GetAccountJettonsHistoryParams) (*oas.AccountEvents, error) {
Expand Down

0 comments on commit 9c9a599

Please sign in to comment.