Transfers can be either of a native asset (such as ETH, Matic, or SOL) or of a token (ERC-20/ERC-721/ERC-1155 on EVM chains, SPL tokens on Solana chains).
When creating a transfer transaction, a value must be set. The value can be:
- Exact amount or
- Maximum amount
While the exact amount is, as its name suggests, the maximum amount behaves differently, depending on the asset being transferred and the type of the blockchain. For an example on how to empty the balance of a specific asset, see Max Transfer.
EVM
- Native asset: On EVM chains, the fee is paid using native currency. A transfer of the entire native currency holdings will be rejected since there are not enough funds to pay for the fee. Therefore, Fordefi system will estimate the amount needed for paying the fee and will transfer the remaining amount. This may leave some native currency “dust” (a very small amount) in the vault. See an example.
Learn more about EVM chain fees. - ERC-20: Will transfer the entire holding amount. See an example.
- ERC-721: Will transfer the specific token ID, it is equivalent to setting the exact amount of “1”. See an example.
- ERC-1155: Sending max is currently not supported. An explicit value to transfer must be provided. See an example.
Solana
- Native asset: On Solana chains, the fee is paid using native currency. A transfer of the entire native currency holdings will be rejected since there are not enough funds to pay for the fee. Choosing max amount will empty the vault, transferring the entire amount, except for the fee. See an example.
Learn more about Solana chain fees. - SPL Token Transfer: Will transfer the entire holding amount. See an example.
Sui
- Native asset: On Sui chains, the gas is paid using native currency. A transfer of the entire native currency holdings will be rejected since there are not enough funds to pay for the fee. Therefore, choosing the maximum amount will empty the vault, transferring the entire amount, except for the fee. See an example.
Learn more about Sui chain fees. - Coin Transfer: Will transfer the entire holding amount. See an example.
TON
- Native asset: On TON chains, the gas is paid using native currency. A transfer of the entire native currency holdings will be rejected since there are not enough funds to pay for the fee. Therefore, choosing the maximum amount will empty the vault, transferring the entire amount, except for the fee. On TON, the price of gas units is determined by the chain config. The fee that is deducted from the maximum amount is currently 0.015 Toncoin. See an example.
- Jetton Transfer: Will transfer the entire holding amount. See an example.
Examples showcasing the max capability are provided below.
Note
API users must strongly authenticate transaction requests that are created programmatically by signing them. Learn more.
EVM
Native currency transfer
On EVM-based chains, the fee is paid using native currency, hence, the lack of native currency in a wallet will prevent you from doing any transaction. Transferring native currency should be done cautiously, to leave enough funds for future transactions, and in case of emptying the vault of funds, transferring native currency out of the vault should be done as the last transaction.
Following is an example of the body of a Create Transaction request for a native EVM currency transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"vault_id": "9095b1aa-2178-4d96-88a5-b709055843e2",
"note": "",
"type": "evm_transaction",
"details": {
"type": "evm_transfer",
"gas": {
"type": "priority",
"priority_level": "medium"
},
"to": "0x1788124E29Feb72eECAe5C08B5aC16932A607063",
"asset_identifier": {
"type": "evm",
"details": {
"type": "native",
"chain": "evm_ethereum_mainnet"
}
},
"value": {
"type": "value",
"value": "10000000000000"
}
}
Token transfer
ERC-20
Following is an example of the body of a Create Transaction request for an ERC-20 token transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"type": "evm_transaction",
"details": {
"type": "evm_transfer",
"gas": {
"type": "priority",
"priority_level": "medium"
},
"to": "0xB572Cf029bD939B260b16A97036456d6165F2222",
"value": {
"type": "value",
"value": "10000000000"
},
"asset_identifier": {
"type": "evm",
"details": {
"type": "erc20",
"token": {
"chain": "ethereum_mainnet",
"hex_repr": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
}
}
},
"note": "Transferring 10,000 USDC",
"vault_id": "8988893a-cf29-4a02-acc7-5bb723c74f47"
}
ERC-721
Following is an example of the body of a Create Transaction request for an ERC-721 token transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"type": "evm_transaction",
"details": {
"type": "evm_transfer",
"gas": {
"type": "priority",
"priority_level": "medium"
},
"to": "0xB572Cf029bD939B260b16A97036456d6165F2222",
"value": {
"type": "value",
"value": "1"
},
"asset_identifier": {
"type": "evm",
"details": {
"type": "erc721",
"token": {
"chain": "ethereum_mainnet",
"hex_repr": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"
},
"token_id": "1337"
}
}
},
"note": "Transferring BoredApe #1337",
"vault_id": "8988893a-cf29-4a02-acc7-5bb723c74f47"
}
ERC-1155
Following is an example of the body of a Create Transaction request for an ERC-1155 token transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"type": "evm_transaction",
"details": {
"type": "evm_transfer",
"gas": {
"type": "priority",
"priority_level": "medium"
},
"to": "0xB572Cf029bD939B260b16A97036456d6165F2222",
"value": {
"type": "value",
"value": "1"
},
"asset_identifier": {
"type": "evm",
"details": {
"type": "erc1155",
"token": {
"chain": "ethereum_mainnet",
"hex_repr": "0xe70659b717112AC4e14284d0db2f5d5703dF8e43"
},
"token_id": "1337"
}
}
},
"note": "Transferring NFT #1337",
"vault_id": "8988893a-cf29-4a02-acc7-5bb723c74f47"
}
Solana
On Solana, each account must hold enough SOL balance for rent. Currently, all accounts are required to be rent-exempt (meaning they hold at least two years' rent). The rent cost is a function of the size of the account (in bytes) and therefore differs between different types of accounts (for example SOL account vs. SPL account). See more about rent exemption.
Native currency transfer
In case the destination account does not exist, the transfer will also create it. In that case, the amount must exceed the rent exemption value.
Following is an example of the body of a Create Transaction request for a native Solana currency transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"type": "solana_transaction",
"details": {
"type": "solana_transfer",
"to": "2d3RofCcy5Jvyi2b6SxtUdd8N7JuRmopXWTUpGGZNSyq",
"value": {
"type": "value",
"value": "10000000000"
},
"asset_identifier": {
"type": "solana",
"details": {
"type": "native",
"chain": "solana_mainnet"
}
}
},
"note": "Transferring 10 SOL",
"vault_id": "8988893a-cf29-4a02-acc7-5bb723c74f47"
}
SPL token transfer
In case the destination account does not exist, the transfer will also create it. Therefore, in that case, the source vault will also pay SOL for the rent exemption.
Following is an example of the body of a Create Transaction request for an SPL token transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"type": "solana_transaction",
"details": {
"type": "solana_transfer",
"to": "2d3RofCcy5Jvyi2b6SxtUdd8N7JuRmopXWTUpGGZNSyq",
"value": {
"type": "value",
"value": "10000000000"
},
"asset_identifier": {
"type": "solana",
"details": {
"type": "spl_token",
"token": {
"chain": "solana_mainnet",
"base58_repr": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}
}
}
},
"note": "Transferring 10000 USDC",
"vault_id": "8988893a-cf29-4a02-acc7-5bb723c74f47"
}
Sui
On Sui chains, the gas is paid using native currency, hence, the lack of native currency in a wallet will prevent you from doing any transaction. For that reason, transfer native currency cautiously, to leave enough funds for future transactions.
Native currency transfer
Following is an example of the body of a Create Transaction request for a native Sui currency transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"type": "sui_transaction",
"details": {
"type": "sui_transfer",
"to": {
"type": "hex",
"address": "0xa398ae37156b6c4b5ee327a7e95a2a8387e1ce9206c91f97235316502aca8883"
},
"value": {
"type": "value",
"value": "10000000000"
},
"gas_config": {
"payment": []
},
"asset_identifier": {
"type": "sui",
"details": {
"type": "native",
"chain": "sui_mainnet"
}
}
},
"note": "Transferring 10 SUI",
"vault_id": "8988893a-cf29-4a02-acc7-5bb723c74f47"
}
Coin transfer
Following is an example of the body of a Create Transaction request for a coin transfer. The general details of creating the request appear here.
{
"signer_type": "api_signer",
"type": "sui_transaction",
"details": {
"type": "sui_transfer",
"to": "0xa398ae37156b6c4b5ee327a7e95a2a8387e1ce9206c91f97235316502aca8883",
"value": {
"type": "value",
"value": "10000000000"
},
"gas_config": {
"payment": []
},
"asset_identifier": {
"type": "sui",
"details": {
"type": "coin",
"token": {
"chain": "sui_mainnet",
"coin_type_str": "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
}
}
}
},
"note": "Transferring 10 USDC",
"vault_id": "8988893a-cf29-4a02-acc7-5bb723c74f47"
}
TON
On TON chains, the gas is paid using native currency, hence, the lack of native currency in a wallet will prevent you from doing any transaction. For that reason, transfer native currency cautiously, to leave enough funds for future transactions. Note that the fees on a native TON transaction are taken separately from the TON amount sent, so you should make sure to have enough funds in the vault for the transfer amount and the expected fee.
Native currency transfer
Following is an example of the body of a Create Transaction request for a native TON currency transfer. The general details of creating the request appear here.
Example of a native transfer:
{
"vault_id": "432b199b-1f71-42bf-ba0b-33d512afa9de",
"note": "string",
"signer_type": "api_signer",
"sign_mode": "auto",
"type": "ton_transaction",
"details": {
"type": "ton_transfer",
"fail_on_prediction_failure": true,
"push_mode": "auto",
"to": {
"type": "hex",
"address": "UQAouB_61QHD91MifxjhbQmBNwulJ9_AA0cUEydZIAcfq52c"
},
"value": {
"type": "value",
"value": "1000000000000000000"
},
"asset_identifier": {
"type": "ton",
"details": {
"type": "native",
"chain": "ton_mainnet"
}
},
"skip_prediction": false
}
}
Jetton transfer
Following is an example of the body of a Create Transaction request for a jetton transfer. The general details of creating the request appear here.
{
"vault_id": "432b199b-1f71-42bf-ba0b-33d512afa9de",
"note": "string",
"signer_type": "initiator",
"sign_mode": "auto",
"type": "ton_transaction",
"details": {
"type": "ton_transfer",
"fail_on_prediction_failure": true,
"push_mode": "auto",
"to": {
"type": "hex",
"address": "UQAouB_61QHD91MifxjhbQmBNwulJ9_AA0cUEydZIAcfq52c"
},
"value": {
"type": "value",
"value": "1000000000000000000"
},
"asset_identifier": {
"type": "ton",
"details": {
"type": "jetton",
"jetton": {
"chain": "ton_mainnet",
"address": "0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe",
}
}
},
"skip_prediction": false
}
}