/**
 * JSON-RPC 2.0 helpers for proxy error responses.
 */
/** True when the request expects a JSON-RPC response (id may be 0). */
export function hasJsonRpcId(id) {
    return id !== undefined && id !== null;
}
export function jsonRpcErrorBody(id, code, message, data) {
    const body = {
        jsonrpc: '2.0',
        error: { code, message, ...(data ? { data } : {}) },
    };
    if (hasJsonRpcId(id)) {
        body.id = id;
    }
    return body;
}
//# sourceMappingURL=json-rpc-utils.js.map