MultiversX Unity Tools
  • Overview
  • Demo App
  • Setup Guide
  • Quick Start
  • Video Tutorials
  • Complete API
    • CallSCMethod
    • CheckTransactionStatus
    • Connect
    • DeepLinkLogin
    • Disconnect
    • GetApiProvider
    • GetConnectedAccount
    • GetNetworkConfig
    • GetRequest
    • IsWalletConnected
    • LoadAllTokens
    • LoadImage
    • LoadNetworkConfig
    • LoadWalletNFTs
    • MakeSCQuery
    • PostRequest
    • SendEGLDTransaction
    • SendESDTTransaction
    • SendMultipleTrasactions
    • SendNFT
    • SignMessage
    • SignMultipleTrasactions
    • RefreshAccount
  • Releases
Powered by GitBook
On this page
  • Description
  • Declaration
  • Parameters
  • Example
  1. Complete API

CheckTransactionStatus

Description

Check the blockchain status of a specific transaction.

Declaration

public static void CheckTransactionStatus(string[] txHash, UnityAction<CompleteCallback<Transaction[]>> completeMethod, float refreshTime)

Parameters

Name
Description

txHash

The hash of the transaction obtained after signing.

completeMethod

Callback to track the result.

refreshTime

Time to wait before querying the TX status. A TX takes some time to process so some delays are good for limiting the usage of the APIs.

Example

public class Test : MonoBehaviour
{
    public void CheckHash()
    {
        string[] txHash = new string[] { "cfaa76ca8707626bd732028298dcf7e1e3e731985c1112a23deb393e92e3fc09" };
        MultiversX.UnityTools.API.CheckTransactionStatus(txHash, TransactionProcessed, 1);
    }

    private void TransactionProcessed(CompleteCallback<Transaction[]> result)
    {
        switch (result.status)
        {
            case OperationStatus.InProgress:
                foreach (Transaction transaction in result.data)
                {
                    Debug.Log($"Tx: {transaction.TxHash} : {transaction.Status}");
                }
                break;
            case OperationStatus.Success:
                Debug.Log("Success");
                break;

            case OperationStatus.Error:
                Debug.LogError($"{result.status} {result.errorMessage}");
                foreach (Transaction transaction in result.data)
                {
                    //the GetLogs() will return additional info about why the transaction failed.
                    Debug.Log($"Tx: {transaction.TxHash} : {transaction.Status} {transaction.GetLogs()}");
                }
                break;
        }
    }
}
PreviousCallSCMethodNextConnect

Last updated 1 year ago