Skip to content

Commit

Permalink
logging for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Jan 3, 2025
1 parent 9493b63 commit f6778ee
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tools/walletextension/rpcapi/blockchain_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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
Expand Down

0 comments on commit f6778ee

Please sign in to comment.