Skip to content

Transfers

Fordefi provides two ways to create asset transfers across all supported chains:

  • Generic Transfer API: For the common use-case of transferring assets (native or tokens), Fordefi offers a special-purpose, chain-agnostic Transfer API.
  • Chain Specific Transactions API: For full control over the underlying transaction. For example: customizing gas fields on EVM or providing your own list of instructions on Solana.

Generic Transfer API

This API exposes a single, unified format that works consistently across all chains.

Using this API, you can create simple and reliable transfers without needing to use chain-specific transaction structure.

Example

{
    "vault_id":"3d3f2a72-6881-4d96-abb1-12341567692c",
    "to":{
         "type":"address",
         "address":"0xC856185610314702c4E8179Bc13e90555F44Ab0E"
      },
    "amount":{
         "type":"value",
         "value":"4000000"
      },
    "asset_identifier":{
         "type":"evm",
         "details":{
               "type":"native",
               "chain":"evm_private_chain"
               }
         },
        "memo":"memo",
        "fee_priority":"medium",
        "note":"note"
    }

Chain Specific Transactions API

This API allows you to construct chain-specific transactions manually, including transfers, with full flexibility.

Fordefi supports a special purpose transaction type. To create a transfer transaction, you can set the details.type field within the request body to the transfer type (e.g. evm_transfersolana_transfer, etc.). For more info, see the documentation for the specific chain: EVMSolanaBitcoinSuiTONStacks.

On each of the supported chains, Fordefi supports creating arbitrary tranasctions in their most general form. For example, on EVM chains, you can create an arbitrary contract call, and on Solana, you can execute any list of instructions. That said, for the most common use case of transferring assets (native or tokens), Fordefi supports a special purpose transaction type. To create a transfer transaction, you can set the details.type field within the request body to the transfer type (e.g. evm_transfer, solana_transfer, etc.). For more info, see the documentation for the specific chain: EVM, Solana, Bitcoin, Sui, TON, Stacks.

Max transfer

To empty your balance of a specific asset, you can set create a maximum-amount transfer transaction, by setting the value.type field to max. Following is an example showing how to construct such a transaction for an ERC-20 token. On all other chains, the valueobject should look the same as in the example below both for native asset and tokens.

{
    "vault_id":"3d3f2a72-6881-4d96-abb1-12341567692c",
    "to":{
      "type":"address",
      "address":"0xC856185610314702c4E8179Bc13e90555F44Ab0E"
     },
     "amount":{
        "type":"max",
        "value":"max"
     },
     "asset_identifier":{
        "type":"evm",
        "details":{
          "type":"native",
          "chain":"evm_private_chain"
        }
     },
      "memo":"memo",
      "fee_priority":"medium",
      "note":"note"
}