Skip to content

Commit b267cf9

Browse files
Merge pull request #145 from thirdweb-dev/vt-abi-decoding-param
feat: add abi_decoding_enabled flag to transactions and events endpoints
2 parents 3d05e4b + b20b593 commit b267cf9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

api/api.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ type QueryParams struct {
4141
Limit int `schema:"limit"`
4242
// @Description List of aggregate functions to apply
4343
Aggregates []string `schema:"aggregate"`
44+
45+
// @Description Flag to enable abi decoding of tx data
46+
AbiDecodingEnabled bool `schema:"abi_decoding_enabled"`
4447
}
4548

4649
// Meta represents metadata for a query response

internal/handlers/logs_handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func handleLogsRequest(c *gin.Context, contractAddress, signature string, eventA
209209
}
210210
queryResult.Data = decodedLogs
211211
} else {
212-
if config.Cfg.API.AbiDecodingEnabled {
212+
if config.Cfg.API.AbiDecodingEnabled && queryParams.AbiDecodingEnabled {
213213
decodedLogs := common.DecodeLogs(chainId.String(), logsResult.Data)
214214
queryResult.Data = decodedLogs
215215
} else {

internal/handlers/transactions_handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func handleTransactionsRequest(c *gin.Context, contractAddress, signature string
220220
}
221221
queryResult.Data = decodedTransactions
222222
} else {
223-
if config.Cfg.API.AbiDecodingEnabled {
223+
if config.Cfg.API.AbiDecodingEnabled && queryParams.AbiDecodingEnabled {
224224
decodedTransactions := common.DecodeTransactions(chainId.String(), transactionsResult.Data)
225225
queryResult.Data = decodedTransactions
226226
} else {

0 commit comments

Comments
 (0)