diff --git a/src.ts/providers/provider-jsonrpc.ts b/src.ts/providers/provider-jsonrpc.ts index 4069ffb1e..97d5fd6c9 100644 --- a/src.ts/providers/provider-jsonrpc.ts +++ b/src.ts/providers/provider-jsonrpc.ts @@ -888,7 +888,8 @@ export abstract class JsonRpcApiProvider extends AbstractProvider { */ getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error { const { method } = payload; - const { error } = _error; + // @ts-expect-error xx + const { error, headers } = _error; if (method === "eth_estimateGas" && error.message) { const msg = error.message; @@ -908,7 +909,7 @@ export abstract class JsonRpcApiProvider extends AbstractProvider { ((payload).params[0]), (result ? result.data: null) ); - e.info = { error, payload }; + e.info = { error, payload, headers }; return e; } @@ -1161,6 +1162,16 @@ export class JsonRpcProvider extends JsonRpcApiPollingProvider { let resp = response.bodyJson; if (!Array.isArray(resp)) { resp = [ resp ]; } + resp.forEach((res: any) => { + if ("error" in res) { + res.headers = {} + for (const [key, value] of Object.entries(response.headers)) { + if (key.toLowerCase().includes('sentio')) { + res.headers[key] = value + } + } + } + }) return resp; }