Quick Start
Actions

Transfer Actions

2min

TransferAction

With TransferAction in the definition of the metadata, you have the flexibility to transfer native tokens. You can specify the receiving address, define the amount to be transferred, or leave it undefined, allowing the user to input a value through the mini-app.

The interface is designed as follows:

TypeScript

  • label: A string that specifies the text to be displayed on the button.
  • recipientAddress (optional): A string prefixed with 0x, representing the default receiving address. If not specified, an input field will be rendered for the user to enter the address.
  • amount (optional): A number representing the amount to transfer. This can be whole numbers or decimals (e.g., 1, 1.2, or 0.1). The amount will be converted to wei using the transform function provided by Wagmi.
  • chainId: An enum representing the chain ID where the transaction will occur. Options include:
    • Avalanche: The origin chain for all transactions.
    • Celo: If selected, the transfer will be a cross-chain operation powered by Wormhole, which incurs higher gas costs.
  • When chainId is set to Celo (or any supported chain differente than Avalanche), the transfer becomes a cross-chain operation. This involves:
    • Sending a gas_limit to cover the transaction fee.
    • Any excess gas is refunded back to the sender on the Avalanche chain.
    • More details on cross-chain transfers can be found in the Cross-Chain section of this documentation.

Interface can be imported as follows:

TypeScript




Updated 17 Jan 2025
Doc contributor
Did this page help you?