Skip to content

Commit 5d55354

Browse files
author
=
committed
fix: add abiDecodingEnabled to config
1 parent 90321fb commit 5d55354

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

configs/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ type BasicAuthConfig struct {
109109
}
110110

111111
type APIConfig struct {
112-
Host string `mapstructure:"host"`
113-
BasicAuth BasicAuthConfig `mapstructure:"basicAuth"`
112+
Host string `mapstructure:"host"`
113+
BasicAuth BasicAuthConfig `mapstructure:"basicAuth"`
114+
AbiDecodingEnabled bool `mapstructure:"abiDecodingEnabled"`
114115
}
115116

116117
type Config struct {

internal/handlers/logs_handlers.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,12 @@ func handleLogsRequest(c *gin.Context, contractAddress, signature string, eventA
209209
}
210210
queryResult.Data = decodedLogs
211211
} else {
212-
decodedLogs := common.DecodeLogs(chainId.String(), logsResult.Data)
213-
queryResult.Data = decodedLogs
212+
if config.Cfg.API.AbiDecodingEnabled {
213+
decodedLogs := common.DecodeLogs(chainId.String(), logsResult.Data)
214+
queryResult.Data = decodedLogs
215+
} else {
216+
queryResult.Data = logsResult.Data
217+
}
214218
}
215219
queryResult.Meta.TotalItems = len(logsResult.Data)
216220
}

internal/handlers/transactions_handlers.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/gin-gonic/gin"
99
"github.com/rs/zerolog/log"
1010
"github.com/thirdweb-dev/indexer/api"
11+
config "github.com/thirdweb-dev/indexer/configs"
1112
"github.com/thirdweb-dev/indexer/internal/common"
1213
"github.com/thirdweb-dev/indexer/internal/rpc"
1314
"github.com/thirdweb-dev/indexer/internal/storage"
@@ -219,8 +220,12 @@ func handleTransactionsRequest(c *gin.Context, contractAddress, signature string
219220
}
220221
queryResult.Data = decodedTransactions
221222
} else {
222-
decodedTransactions := common.DecodeTransactions(chainId.String(), transactionsResult.Data)
223-
queryResult.Data = decodedTransactions
223+
if config.Cfg.API.AbiDecodingEnabled {
224+
decodedTransactions := common.DecodeTransactions(chainId.String(), transactionsResult.Data)
225+
queryResult.Data = decodedTransactions
226+
} else {
227+
queryResult.Data = transactionsResult.Data
228+
}
224229
}
225230
queryResult.Meta.TotalItems = len(transactionsResult.Data)
226231
}

0 commit comments

Comments
 (0)