From 6b1f39f6543d75437835cd40c0afc60b41d30a6a Mon Sep 17 00:00:00 2001 From: iuwqyir Date: Tue, 4 Mar 2025 23:12:32 +0200 Subject: [PATCH] remove camelcase from api responses --- internal/common/log.go | 26 +++++++++++++++----------- internal/common/transaction.go | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/internal/common/log.go b/internal/common/log.go index 3eb4455..49a66bd 100644 --- a/internal/common/log.go +++ b/internal/common/log.go @@ -58,10 +58,12 @@ type LogModel struct { } type DecodedLogDataModel struct { - Name string `json:"name"` - Signature string `json:"signature"` - IndexedParams map[string]interface{} `json:"indexedParams" swaggertype:"object"` - NonIndexedParams map[string]interface{} `json:"nonIndexedParams" swaggertype:"object"` + Name string `json:"name"` + Signature string `json:"signature"` + IndexedParamsDeprecated map[string]interface{} `json:"indexedParams" swaggertype:"object" deprecated:"true"` + IndexedParams map[string]interface{} `json:"indexed_params" swaggertype:"object"` + NonIndexedParamsDeprecated map[string]interface{} `json:"nonIndexedParams" swaggertype:"object" deprecated:"true"` + NonIndexedParams map[string]interface{} `json:"non_indexed_params" swaggertype:"object"` } type DecodedLogModel struct { @@ -77,13 +79,13 @@ type RawReceipt = map[string]interface{} type DecodedLogData struct { Name string `json:"name"` Signature string `json:"signature"` - IndexedParams map[string]interface{} `json:"indexedParams"` - NonIndexedParams map[string]interface{} `json:"nonIndexedParams"` + IndexedParams map[string]interface{} `json:"indexed_params"` + NonIndexedParams map[string]interface{} `json:"non_indexed_params"` } type DecodedLog struct { Log - Decoded DecodedLogData `json:"decodedData"` + Decoded DecodedLogData `json:"decoded"` } func DecodeLogs(chainId string, logs []Log) []*DecodedLog { @@ -251,10 +253,12 @@ func (l *Log) Serialize() LogModel { func (l *DecodedLog) Serialize() DecodedLogModel { decodedData := DecodedLogDataModel{ - Name: l.Decoded.Name, - Signature: l.Decoded.Signature, - IndexedParams: l.Decoded.IndexedParams, - NonIndexedParams: l.Decoded.NonIndexedParams, + Name: l.Decoded.Name, + Signature: l.Decoded.Signature, + IndexedParams: l.Decoded.IndexedParams, + IndexedParamsDeprecated: l.Decoded.IndexedParams, + NonIndexedParams: l.Decoded.NonIndexedParams, + NonIndexedParamsDeprecated: l.Decoded.NonIndexedParams, } return DecodedLogModel{ LogModel: l.Log.Serialize(), diff --git a/internal/common/transaction.go b/internal/common/transaction.go index 513f10f..05ad062 100644 --- a/internal/common/transaction.go +++ b/internal/common/transaction.go @@ -53,7 +53,7 @@ type DecodedTransactionData struct { type DecodedTransaction struct { Transaction - Decoded DecodedTransactionData `json:"decodedData"` + Decoded DecodedTransactionData `json:"decoded"` } // TransactionModel represents a simplified Transaction structure for Swagger documentation