@@ -49,10 +49,10 @@ func GetTokenBalancesByType(c *gin.Context) {
4949 return
5050 }
5151 tokenType := c .Param ("type" )
52- if tokenType != "erc20" && tokenType != "erc1155" && tokenType != "erc721" {
53- api .BadRequestErrorHandler (c , fmt .Errorf ("invalid token type '%s'" , tokenType ))
54- return
52+ if tokenType == "" {
53+ tokenType = c .Query ("token_type" )
5554 }
55+
5656 owner := strings .ToLower (c .Param ("owner" ))
5757 if ! strings .HasPrefix (owner , "0x" ) {
5858 api .BadRequestErrorHandler (c , fmt .Errorf ("invalid owner address '%s'" , owner ))
@@ -63,6 +63,17 @@ func GetTokenBalancesByType(c *gin.Context) {
6363 api .BadRequestErrorHandler (c , fmt .Errorf ("invalid token address '%s'" , tokenAddress ))
6464 return
6565 }
66+
67+ tokenIds := []* big.Int {}
68+ tokenIdsStr := strings .TrimSpace (c .Query ("token_ids" ))
69+ if tokenIdsStr != "" {
70+ tokenIds , err = parseTokenIds (c .Query ("token_ids" ))
71+ if err != nil {
72+ api .BadRequestErrorHandler (c , fmt .Errorf ("invalid token ids '%s'" , tokenIdsStr ))
73+ return
74+ }
75+ }
76+
6677 hideZeroBalances := c .Query ("hide_zero_balances" ) != "false"
6778
6879 columns := []string {"address" , "sum(balance) as balance" }
@@ -78,6 +89,7 @@ func GetTokenBalancesByType(c *gin.Context) {
7889 TokenType : tokenType ,
7990 TokenAddress : tokenAddress ,
8091 ZeroBalance : hideZeroBalances ,
92+ TokenIds : tokenIds ,
8193 GroupBy : groupBy ,
8294 SortBy : c .Query ("sort_by" ),
8395 SortOrder : c .Query ("sort_order" ),
0 commit comments