@@ -65,6 +65,17 @@ export default function Component() {
6565 events: [preparedEvent]
6666 });
6767}` ,
68+ unity : `using Thirdweb;
69+
70+ // Get your contract
71+ var contract = await ThirdwebManager.Instance.GetContract(
72+ address: "{{contract_address}}",
73+ chainId: {{chainId}},
74+ abi: "optional-abi"
75+ );
76+
77+ // Listen to contract events
78+ var events = await contract.Events("{{function}}");` ,
6879 } ,
6980 install : {
7081 javascript : "npm i thirdweb" ,
@@ -100,6 +111,17 @@ export default function Component() {
100111 params: [{{args}}]
101112 });
102113}` ,
114+ unity : `using Thirdweb;
115+
116+ // Get your contract
117+ var contract = await ThirdwebManager.Instance.GetContract(
118+ address: "{{contract_address}}",
119+ chainId: {{chainId}},
120+ abi: "optional-abi"
121+ );
122+
123+ // Read from the contract
124+ var result = await contract.Read<T>(contract, "{{function}}", {{args}});` ,
103125 } ,
104126 setup : {
105127 javascript : `import { createThirdwebClient, getContract } from "thirdweb";
@@ -165,11 +187,12 @@ function App() {
165187` ,
166188 unity : `using Thirdweb;
167189
168- // Reference the SDK
169- var sdk = ThirdwebManager.Instance.SDK;
170-
171190// Get your contract
172- var contract = sdk.GetContract("{{contract_address}}");` ,
191+ var contract = await ThirdwebManager.Instance.GetContract(
192+ address: "{{contract_address}}",
193+ chainId: {{chainId}},
194+ abi: "optional-abi"
195+ );` ,
173196 } ,
174197 write : {
175198 javascript : `import { prepareContractCall, sendTransaction } from "thirdweb";
@@ -213,6 +236,58 @@ export default function Component() {
213236 sendTransaction(transaction);
214237 }
215238}` ,
239+ unity : `using Thirdweb;
240+
241+ // Get your contract
242+ var contract = await ThirdwebManager.Instance.GetContract(
243+ address: "{{contract_address}}",
244+ chainId: {{chainId}},
245+ abi: "optional-abi"
246+ );
247+
248+ // Write to the contract
249+ var transactionReceipt = await contract.Write(wallet, contract, "{{function}}", weiValue, {{args}});` ,
250+ } ,
251+ api : {
252+ read : `curl https://api.thirdweb.com/v1/contracts/read \\
253+ --request POST \\
254+ --header 'Content-Type: application/json' \\
255+ --header 'x-client-id: YOUR_CLIENT_ID' \\
256+ # OR use secret key (backend only, not frontend): --header 'x-secret-key: YOUR_SECRET_KEY' \\
257+ --data '{
258+ "calls": [
259+ {
260+ "contractAddress": "{{contract_address}}",
261+ "method": "{{function}}"
262+ }
263+ ],
264+ "chainId": {{chainId}}
265+ }'` ,
266+ write : `curl -X POST https://api.thirdweb.com/v1/contracts/write \\
267+ -H "Content-Type: application/json" \\
268+ -H "x-secret-key: YOUR_SECRET_KEY" \\
269+ # Note: Secret key should only be used in backend environments, not frontend \\
270+ -d '{
271+ "calls": [
272+ {
273+ "contractAddress": "{{contract_address}}",
274+ "method": "{{function}}",
275+ "params": [{{args}}]
276+ }
277+ ],
278+ "chainId": {{chainId}},
279+ "from": "0x1234567890123456789012345678901234567890"
280+ }'` ,
281+ events : `curl https://api.thirdweb.com/v1/contracts/events \\
282+ --request POST \\
283+ --header 'Content-Type: application/json' \\
284+ --header 'x-client-id: YOUR_CLIENT_ID' \\
285+ # OR use secret key (backend only, not frontend): --header 'x-secret-key: YOUR_SECRET_KEY' \\
286+ --data '{
287+ "contractAddress": "{{contract_address}}",
288+ "eventName": "{{function}}",
289+ "chainId": {{chainId}}
290+ }'` ,
216291 } ,
217292} ;
218293
@@ -490,6 +565,9 @@ export function formatSnippet(
490565 : "event" ,
491566 } ) ;
492567 break ;
568+ case "api" :
569+ // For API, we don't need special extension handling, just use the standard templates
570+ break ;
493571 }
494572 }
495573 // end hacks on hacks on hacks -- now just hacks on hacks from here on out
0 commit comments