diff --git a/src/hooks/useAgentPermissions.ts b/src/hooks/useAgentPermissions.ts index a0f59272..416354bc 100644 --- a/src/hooks/useAgentPermissions.ts +++ b/src/hooks/useAgentPermissions.ts @@ -13,7 +13,8 @@ export function useAgentPermissions(agentAddress: string | null) { const [contractAddress, contractName] = agentAddress.split("."); const res = await fetch( - `${process.env.NEXT_PUBLIC_CACHE_URL}/contract-calls/read-only/${contractAddress}/${contractName}/get-agent-permissions`, + // `${process.env.NEXT_PUBLIC_CACHE_URL}/contract-calls/read-only/${contractAddress}/${contractName}/get-agent-permissions`, + `https://aibtcdev-cache-preview.hosting-962.workers.dev/contract-calls/read-only/${contractAddress}/${contractName}/get-agent-permissions`, { method: "POST", headers: { diff --git a/src/hooks/useContractApproval.ts b/src/hooks/useContractApproval.ts index 9a902cb8..ad66e174 100644 --- a/src/hooks/useContractApproval.ts +++ b/src/hooks/useContractApproval.ts @@ -13,7 +13,8 @@ async function fetchApprovals( const results = await Promise.all( contractIds.map(async (targetContractId) => { const res = await fetch( - `${process.env.NEXT_PUBLIC_CACHE_URL}/contract-calls/read-only/${agentAddr}/${agentName}/is-approved-contract`, + // `${process.env.NEXT_PUBLIC_CACHE_URL}/contract-calls/read-only/${agentAddr}/${agentName}/is-approved-contract`, + `https://aibtcdev-cache-preview.hosting-962.workers.dev/contract-calls/read-only/${agentAddr}/${agentName}/get-agent-permissions`, { method: "POST", headers: { "Content-Type": "application/json" }, diff --git a/src/lib/vote-utils.ts b/src/lib/vote-utils.ts index 49657093..a0004701 100644 --- a/src/lib/vote-utils.ts +++ b/src/lib/vote-utils.ts @@ -7,10 +7,10 @@ export function formatVotes(votes: number): string { return (votes / 1e8).toString(); } -const url = - process.env.NEXT_PUBLIC_STACKS_NETWORK === "testnet" - ? process.env.NEXT_PUBLIC_CACHE_URL_TESTNET - : process.env.NEXT_PUBLIC_CACHE_URL; +// const url = +// process.env.NEXT_PUBLIC_STACKS_NETWORK === "testnet" +// ? process.env.NEXT_PUBLIC_CACHE_URL_TESTNET +// : process.env.NEXT_PUBLIC_CACHE_URL; export async function getProposalVotes( contractPrincipal: string, @@ -25,9 +25,9 @@ export async function getProposalVotes( } try { - // Call the endpoint with POST method and the correct request body format + // `${url}/contract-calls/read-only/${contractAddress}/${contractName}/get-proposal`, const response = await fetch( - `${url}/contract-calls/read-only/${contractAddress}/${contractName}/get-proposal`, + `https://aibtcdev-cache-preview.hosting-962.workers.dev/contract-calls/read-only/${contractAddress}/${contractName}/get-proposal`, { method: "POST", headers: { diff --git a/src/services/vote.service.ts b/src/services/vote.service.ts index a9d68ebd..a163ad70 100644 --- a/src/services/vote.service.ts +++ b/src/services/vote.service.ts @@ -280,13 +280,14 @@ export async function getProposalVotes( const proposalIdString = proposalId.toString(); try { - const apiUrl = `${url}/contract-calls/read-only/${contractAddress}/${contractName}/get-proposal`; + // const apiUrl = `${url}/contract-calls/read-only/${contractAddress}/${contractName}/get-proposal`; + const apiUrl = `https://aibtcdev-cache-preview.hosting-962.workers.dev/read-only/${contractAddress}/${contractName}/get-agent-permissions`; const response = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ functionArgs: [{ type: "uint", value: proposalIdString }], - // Optional: Add cache control if the endpoint supports it + network: process.env.NEXT_PUBLIC_STACKS_NETWORK, cacheControl: bustCache ? { bustCache: true, ttl: 3600 } : undefined, }), });