Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

Commit 00d6b6e

Browse files
fix: Correctly pass Promise<Response> to withTimeout
Co-authored-by: aider (openrouter/x-ai/grok-4) <aider@aider.chat>
1 parent 6e70a69 commit 00d6b6e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/services/stacks-api-service.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ export class StacksApiService {
9090
};
9191

9292
// Perform the fetch with timeout
93+
const fetchPromise = (async () => {
94+
const resp = await (customFetchFn ? customFetchFn(url, fetchOptions) : fetch(url, fetchOptions)) as Response;
95+
if (onResponse) onResponse(resp);
96+
return resp;
97+
})();
98+
9399
const response = await withTimeout<Response>(
94-
async () => {
95-
const resp = await (customFetchFn ? customFetchFn(url, fetchOptions) : fetch(url, fetchOptions)) as Response;
96-
if (onResponse) onResponse(resp);
97-
return resp;
98-
},
100+
fetchPromise,
99101
this.timeoutMs,
100102
`Contract call to ${contractAddress}.${contractName}::${functionName} timed out`
101103
);

0 commit comments

Comments
 (0)