From f6778eedef88f3df1113dc426086eea5ffd17fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Fri, 3 Jan 2025 13:28:49 +0100 Subject: [PATCH] logging for debugging --- .../walletextension/rpcapi/blockchain_api.go | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/walletextension/rpcapi/blockchain_api.go b/tools/walletextension/rpcapi/blockchain_api.go index 554da5a76..ec140ff0a 100644 --- a/tools/walletextension/rpcapi/blockchain_api.go +++ b/tools/walletextension/rpcapi/blockchain_api.go @@ -53,7 +53,18 @@ func (api *BlockChainAPI) BlockNumber() hexutil.Uint64 { } func (api *BlockChainAPI) GetBalance(ctx context.Context, address gethcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) { - return ExecAuthRPC[hexutil.Big]( + user, err := extractUserForRequest(ctx, api.we) + if err != nil { + return nil, err + } + + // Add detailed logging + api.we.Logger().Info("GetBalance request received", + "address", address.Hex(), + "blockNrOrHash", blockNrOrHash, + "user", user) + + balance, err := ExecAuthRPC[hexutil.Big]( ctx, api.we, &AuthExecCfg{ @@ -69,6 +80,21 @@ func (api *BlockChainAPI) GetBalance(ctx context.Context, address gethcommon.Add address, blockNrOrHash, ) + + // Log the result + if err != nil { + api.we.Logger().Error("GetBalance request failed", + "address", address.Hex(), + "blockNrOrHash", blockNrOrHash, + "error", err) + } else { + api.we.Logger().Info("GetBalance request completed", + "address", address.Hex(), + "blockNrOrHash", blockNrOrHash, + "balance", balance) + } + + return balance, err } // Result structs for GetProof