> For the complete documentation index, see [llms.txt](https://docs.usemeta.fi/unity-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.usemeta.fi/unity-sdk/sdk-reference/transfertokens.md).

# TransferTokens

{% hint style="info" %}
This function triggers a modal for the user to confirm the transfer
{% endhint %}

## Description

Function to trigger a transfer for a native or ERC20 token. This will trigger a confirmation modal displaying a summary of the transaction and associated fees for the user.

## Details

### Signature

{% code overflow="wrap" %}

```csharp
Task TransferTokens(dynamic args, Action<dynamic> callback = null)
```

{% endcode %}

### Arguments

<table><thead><tr><th width="258">Parameter</th><th width="114">Type</th><th>Definition</th></tr></thead><tbody><tr><td><code>callback?</code></td><td>Action&#x3C;dynamic></td><td><p>Function to callback upon txhash, success or failed transfer. <br>Structure of result object passed into callback function:</p><pre class="language-json" data-line-numbers><code class="lang-json"><strong>{
</strong><strong>    "status": "TXHASH", // "TXHASH"/"SUCCESS"/"FAILED"
</strong><strong>    "errorMsg": "", 
</strong><strong>    "txHash": "0xec90b7c220b1d9550c202ed7adb7db97be2b8c8b9f422bb2d3c555498d95ef49",
</strong><strong>    "from": "0xb8E46105a6F11E3250837897b3A10450716b28d8",
</strong><strong>    "to": "0xfFEaf294116b610d0cdD4afaAfe861563c72BB76",
</strong><strong>    "amount": "0.1",
</strong><strong>    "currency": Object // type Currency class
</strong><strong>}
</strong></code></pre></td></tr><tr><td><code>args.to?</code></td><td>String</td><td>Address to send tokens to. If not passed in, will prompt user to enter address.</td></tr><tr><td><code>args.amount?</code></td><td>String</td><td>Amount to send in <strong>display units</strong> of the currency. So if you want the user to pay 0.5 ETH, pass in '0.5' to this field. If value not passed in, will prompt user to pass in the amount</td></tr><tr><td><code>args.currency?</code></td><td>Metafi.Unity.Asset</td><td>Asset object of the currency you want to send. If value not passed in, will prompt user to pass in the currency</td></tr></tbody></table>

### Return Value

None

## Example

Calling transfer without args

{% code lineNumbers="true" %}

```csharp
using System;
using Metafi.Unity;

public class TransferButton : MonoBehaviour {
    public async void TransferTokensWithoutArgs(){
        await MetafiProvider.Instance.TransferTokens( new {}, 
        ((Action<dynamic>) (result => {
            Debug.Log("TransferTokens complete, result: " + result.ToString());
        })));       
    }
}
```

{% endcode %}

Calling transfer with args

{% code lineNumbers="true" %}

```csharp
using System;
using Metafi.Unity;

public class TransferButton : MonoBehaviour {
    public async void TransferTokensWithArgs(){
        await MetafiProvider.Instance.TransferTokens( new {
            to = "to_address",
            amount = "amount",
            currency = Assets.GOERLI_ETH,
        }, 
        ((Action<dynamic>) (result => {
            Debug.Log("TransferTokens complete, result: " + result.ToString());
        })));

    }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.usemeta.fi/unity-sdk/sdk-reference/transfertokens.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
