demos fix linting

This commit is contained in:
mfahampshire
2026-06-09 17:17:16 +01:00
parent 7529cde148
commit d15c47dbde
4 changed files with 326 additions and 19 deletions
@@ -145,7 +145,9 @@ export async function decompressBody(body: Uint8Array, headers: Record<string, s
else if (enc === 'deflate-raw') format = 'deflate-raw';
if (!format) return body;
const stream = new Blob([body]).stream().pipeThrough(new DecompressionStream(format));
// body is always a plain ArrayBuffer-backed Uint8Array at runtime; the cast
// sidesteps the TS 5.7 generic-typed-array vs BlobPart (ArrayBuffer) mismatch.
const stream = new Blob([body as BlobPart]).stream().pipeThrough(new DecompressionStream(format));
const buf = await new Response(stream).arrayBuffer();
return new Uint8Array(buf);
}
@@ -216,7 +218,7 @@ export function buildProvider(rpcUrl: string, mixFetch: MixFetchFn, ensLog: LogF
const raw = await callMixFetch(mixFetch, req.url, {
method: req.method,
headers: req.headers,
body: req.body ?? undefined,
body: (req.body ?? undefined) as BodyInit | undefined,
});
const ms = (performance.now() - t0).toFixed(0);
@@ -129,7 +129,9 @@ export async function shieldEth(opts: {
// Step 2: gas estimate (needs the funder's address to simulate the call).
log('step 2/4: estimating gas via mixFetch...');
const gasEstResp = await withRetry(
// withRetry can't infer T from the `any`-typed SDK call, so it falls back to
// unknown; annotate the result to read its fields.
const gasEstResp: any = await withRetry(
() =>
railgun.gasEstimateForShieldBaseToken(
TXID_VERSION_V2,
@@ -44,7 +44,9 @@ export async function decompressBody(body: Uint8Array, headers: Record<string, s
else if (enc === 'deflate') format = 'deflate';
else if (enc === 'deflate-raw') format = 'deflate-raw';
if (!format) return body;
const stream = new Blob([body]).stream().pipeThrough(new DecompressionStream(format));
// body is always a plain ArrayBuffer-backed Uint8Array at runtime; the cast
// sidesteps the TS 5.7 generic-typed-array vs BlobPart (ArrayBuffer) mismatch.
const stream = new Blob([body as BlobPart]).stream().pipeThrough(new DecompressionStream(format));
return new Uint8Array(await new Response(stream).arrayBuffer());
}
@@ -61,7 +63,7 @@ function makeGetUrl(mixFetch: MixFetchFn) {
const raw = await callMixFetch(mixFetch, req.url, {
method: req.method,
headers: req.headers,
body: req.body ?? undefined,
body: (req.body ?? undefined) as BodyInit | undefined,
});
const body = await decompressBody(raw.body, raw.headers);
return {