Skip to content

Commit 7fa0d4c

Browse files
committed
feat: include token type to response
1 parent b500ad4 commit 7fa0d4c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/handlers/token_handlers.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type HolderModel struct {
2323
HolderAddress string `json:"holder_address" ch:"owner"`
2424
TokenId string `json:"token_id" ch:"token_id"`
2525
Balance string `json:"balance" ch:"balance"`
26+
TokenType string `json:"token_type" ch:"token_type"`
2627
}
2728

2829
// @Summary Get token balances of an address by type
@@ -220,8 +221,8 @@ func GetTokenHoldersByType(c *gin.Context) {
220221
groupBy := []string{"owner"}
221222

222223
if !strings.Contains(strings.Join(tokenTypes, ","), "erc20") {
223-
columns = []string{"owner", "token_id", "sum(balance) as balance"}
224-
groupBy = []string{"owner", "token_id"}
224+
columns = []string{"owner", "token_id", "sum(balance) as balance", "token_type"}
225+
groupBy = []string{"owner", "token_id", "token_type"}
225226
}
226227

227228
tokenIds, err := getTokenIdsFromReq(c)
@@ -286,5 +287,6 @@ func serializeHolder(holder common.TokenBalance) HolderModel {
286287
}
287288
return ""
288289
}(),
290+
TokenType: holder.TokenType,
289291
}
290292
}

0 commit comments

Comments
 (0)