Skip to content

Commit 79ea412

Browse files
committed
Update events API calls to use GET with new endpoint
Refactored the events fetch and curl examples to use the new GET endpoint format with path parameters instead of POST with a JSON body. This aligns with the updated thirdweb API for fetching contract events.
1 parent b378489 commit 79ea412

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

apps/dashboard/src/@/components/contracts/code-overview.tsx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -342,17 +342,12 @@ const data = await response.json();`,
342342
});
343343
344344
const data = await response.json();`,
345-
events: `const response = await fetch('https://api.thirdweb.com/v1/contracts/events', {
346-
method: 'POST',
345+
events: `const response = await fetch('https://api.thirdweb.com/v1/contracts/{{chainId}}/{{contract_address}}/events?eventSignature={{function}}', {
346+
method: 'GET',
347347
headers: {
348348
'Content-Type': 'application/json',
349349
'x-secret-key': '<YOUR_SECRET_KEY>'
350-
},
351-
body: JSON.stringify({
352-
contractAddress: "{{contract_address}}",
353-
eventName: "{{function}}",
354-
chainId: {{chainId}}
355-
})
350+
}
356351
});
357352
358353
const data = await response.json();`,
@@ -386,15 +381,10 @@ const data = await response.json();`,
386381
"chainId": {{chainId}},
387382
"from": "<YOUR_WALLET_ADDRESS>"
388383
}'`,
389-
events: `curl https://api.thirdweb.com/v1/contracts/events \\
390-
--request POST \\
384+
events: `curl https://api.thirdweb.com/v1/contracts/{{chainId}}/{{contract_address}}/events?eventSignature={{function}} \\
385+
--request GET \\
391386
--header 'Content-Type: application/json' \\
392-
--header 'x-secret-key: <YOUR_SECRET_KEY>' \\
393-
--data '{
394-
"contractAddress": "{{contract_address}}",
395-
"eventName": "{{function}}",
396-
"chainId": {{chainId}}
397-
}'`,
387+
--header 'x-secret-key: <YOUR_SECRET_KEY>'`,
398388
},
399389
};
400390

0 commit comments

Comments
 (0)