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

Commit 6e70a69

Browse files
fix: Update network object and URL construction for Stacks API calls
Co-authored-by: aider (openrouter/x-ai/grok-4) <aider@aider.chat>
1 parent 1fc361f commit 6e70a69

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/services/stacks-api-service.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ export class StacksApiService {
7373
// Determine network object
7474
const networkObj = network === 'mainnet' ? STACKS_MAINNET : STACKS_TESTNET;
7575

76-
// Build API URL
77-
// TODO: coreUrl does not exist, updated object to use latest constant but property is missing. will include latest network docs to assist in fix.
78-
const url = `${networkObj.coreUrl}/v2/contracts/call-read/${contractAddress}/${contractName}`;
76+
// Build API URL using client.baseUrl as per latest @stacks/network docs
77+
const url = `${networkObj.client.baseUrl}/v2/contracts/call-read/${contractAddress}/${contractName}/${functionName}`;
7978

8079
// Prepare request body
8180
const body = JSON.stringify({
@@ -91,18 +90,17 @@ export class StacksApiService {
9190
};
9291

9392
// Perform the fetch with timeout
94-
const response = await withTimeout(
95-
// TODO: issue with assinging Promise<unknown> to Promise<Response> here
93+
const response = await withTimeout<Response>(
9694
async () => {
97-
const resp = await (customFetchFn ? customFetchFn(url, fetchOptions) : fetch(url, fetchOptions));
95+
const resp = await (customFetchFn ? customFetchFn(url, fetchOptions) : fetch(url, fetchOptions)) as Response;
9896
if (onResponse) onResponse(resp);
9997
return resp;
10098
},
10199
this.timeoutMs,
102100
`Contract call to ${contractAddress}.${contractName}::${functionName} timed out`
103101
);
104102

105-
// Parse response - TODO related, we need to type this correctly response is unknown
103+
// Parse response
106104
const data = await response.json<any>();
107105

108106
if (!response.ok) {

0 commit comments

Comments
 (0)