Skip to content

Commit fadd8a0

Browse files
authored
Merge pull request #485 from reown-com/devin/1750157446-update-unity-actions-api
Add GetTransactionReceiptAsync API documentation to Unity Actions page
2 parents 16cff6d + 638c1cb commit fadd8a0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

appkit/unity/core/actions.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,42 @@ Get the current gas price in wei.
335335
BigInteger gasPrice = await AppKit.EVM.GetGasPriceAsync();
336336
```
337337

338+
### Get Transaction Receipt
339+
340+
Get the receipt for a transaction by its hash. This method polls the blockchain until the transaction is confirmed or times out.
341+
342+
```csharp
343+
// Basic usage - get receipt for a transaction
344+
TransactionReceipt receipt = await AppKit.EVM.GetTransactionReceiptAsync("0x123...");
345+
346+
Debug.Log($"Transaction Hash: {receipt.TransactionHash}");
347+
Debug.Log($"Block Hash: {receipt.BlockHash}");
348+
Debug.Log($"Status: {(receipt.StatusSuccessful ? "Success" : "Failed")}");
349+
Debug.Log($"Gas Used: {receipt.GasUsed}");
350+
351+
// With custom timeout (default is 3 minutes)
352+
TransactionReceipt receipt = await AppKit.EVM.GetTransactionReceiptAsync(
353+
"0x123...", // transaction hash
354+
TimeSpan.FromSeconds(120) // custom timeout
355+
);
356+
357+
// With custom timeout and polling interval (default polling is 12 seconds)
358+
TransactionReceipt receipt = await AppKit.EVM.GetTransactionReceiptAsync(
359+
"0x123...", // transaction hash
360+
TimeSpan.FromSeconds(120), // custom timeout
361+
TimeSpan.FromMilliseconds(500) // poll every 500ms
362+
);
363+
364+
// With cancellation token for manual cancellation
365+
using var cts = new CancellationTokenSource();
366+
TransactionReceipt receipt = await AppKit.EVM.GetTransactionReceiptAsync(
367+
"0x123...", // transaction hash
368+
TimeSpan.FromMinutes(3), // timeout
369+
TimeSpan.FromSeconds(12), // polling interval
370+
cts.Token // cancellation token
371+
);
372+
```
373+
338374
### RPC Request
339375

340376
Make a direct RPC request to the blockchain node.

0 commit comments

Comments
 (0)