# SendESDTTransaction

## Description

Send an ESDT transaction for signing into the xPortal wallet. After it is signed the transaction will be automatically broadcasted to the blockchain.

## Declaration

```csharp
public static void SendESDTTransaction(string destinationAddress, ESDT token, string amount, UnityAction<CompleteCallback<string[]>> completeMethod)
```

## Parameters

<table><thead><tr><th width="234">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>destinationAddress</strong></td><td>The erd address of the receiver.</td></tr><tr><td><strong>token</strong></td><td>Token to send.</td></tr><tr><td><strong>amount</strong></td><td>Amount of token to send(in decimals) as a string.</td></tr><tr><td><strong>completeMethod</strong></td><td>Callback to track the status of the transaction. At complete, the message will be the transaction hash.</td></tr></tbody></table>

## Example

```csharp
public class Test : MonoBehaviour
{
    private string destinationAddress = "erd1jza9qqw0l24svfmm2u8wj24gdf84hksd5xrctk0s0a36leyqptgs5whlhf";
    private string amount = "1";

    //define the token
    private ESDT USDC = ESDT.ESDT_TOKEN(ESDTTokenType.FungibleESDT, "USDC", "USDC-8d4068", 6);

    public void SendUSDC()
    {
        //send transaction
        MultiversX.UnityTools.API.SendESDTTransaction(destinationAddress, USDC, amount, CompleteMethod);
    }

    private void CompleteMethod(CompleteCallback<string[]> result)
    {
        switch (result.status)
        {
            case OperationStatus.InProgress:
                Debug.Log($"Waiting for xPortal signature");
                break;
            case OperationStatus.Error:
                Debug.LogError($"{result.errorMessage}");
                break;
            case OperationStatus.Success:
                //result.data contains the hash of the transaction
                //at this point transaction is broadcasted to the blockchain to be processed
                //use this method to check if it was processed succesfully or not
                MultiversX.UnityTools.API.CheckTransactionStatus(result.data, TransactionProcessed, 1);
                break;
        }
    }

    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;
        }
    }
}
```
