Debug-log every API request and response
Some checks failed
check / check (push) Has been cancelled

Add debugFetch wrapper in log.js that logs method, URL, and body on
request, and status code on response. Replace all fetch() calls
across balances, transactions, tokens, background RPC proxy, and
settings validation with debugFetch.
This commit is contained in:
2026-02-26 15:40:09 +07:00
parent 47e690f466
commit d24c10ca9c
6 changed files with 24 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ const {
formatUnits,
} = require("ethers");
const { ERC20_ABI } = require("./constants");
const { log } = require("./log");
const { log, debugFetch } = require("./log");
const { deriveAddressFromXpub } = require("./wallet");
// Use a static network to skip auto-detection (which can fail and cause
@@ -40,7 +40,7 @@ function formatTokenBalance(raw, decimals) {
// Returns [{ address, symbol, decimals, balance }].
async function fetchTokenBalances(address, blockscoutUrl) {
try {
const resp = await fetch(
const resp = await debugFetch(
blockscoutUrl + "/addresses/" + address + "/token-balances",
);
if (!resp.ok) {