TransferTokens

This function triggers a modal for the user to confirm the transfer

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

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

Arguments

Return Value

None

Example

Calling transfer without args

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());
        })));       
    }
}

Calling transfer with args

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());
        })));

    }
}

Last updated