Skip to content

Commit ad49d77

Browse files
authored
Merge pull request #190 from immutable/docs/tx-receipt-status
[DX-2784] docs: transaction receipt response status field docs, sample app transaction status check
2 parents 5b29efa + 41215b6 commit ad49d77

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

sample/Assets/Scripts/AuthenticatedScript.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,21 @@ public async void GetZkTransactionReceiptStatus()
413413
ShowOutput($"Getting zkEVM transaction receipt status...");
414414

415415
TransactionReceiptResponse response = await passport.ZkEvmGetTransactionReceipt(ZkGetTransactionReceiptHash.text);
416+
string status = "Transaction receipt status: ";
416417
ShowOutput($"Transaction receipt status: {(response.status == "0x1" ? "Success" : "Failed")}");
418+
switch (response.status)
419+
{
420+
case "0x1":
421+
status += "Success";
422+
break;
423+
case "0x0":
424+
status += "Failed";
425+
break;
426+
case null:
427+
status += "Still processing";
428+
break;
429+
}
430+
ShowOutput(status);
417431
}
418432
catch (Exception ex)
419433
{

src/Packages/Passport/Runtime/Scripts/Private/Model/Response/TransactionReceiptResponse.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ public class TransactionReceiptResponse
2121
public string logsBloom;
2222

2323
/// <summary>
24-
/// Either 1 (success) or 0 (failure) encoded as a hexadecimal.
24+
/// Possible reponses:
25+
/// <list type="bullet">
26+
/// <item>
27+
/// <description>Success: 0x0</description>
28+
/// </item>
29+
/// <item>
30+
/// <description>Failure: 0x0</description>
31+
/// </item>
32+
/// <item>
33+
/// <description>Null: Transaction is still processing</description>
34+
/// </item>
35+
/// </list>
2536
/// </summary>
2637
public string status;
2738

0 commit comments

Comments
 (0)