Exchange transfers
Fordefi supports both depositing into and withdrawing from your connected exchange vaults.
Decimal precision
It is important to note that for withdrawals from an exchange vault, the Fordefi API requires amounts to be specified with 18-decimal precision, regardless of the asset's native decimal places.
This convention exists because assets held on an exchange do not inherently have an associated blockchain, and the same asset can be withdrawn to multiple different chains, each potentially using different decimal standards. To maintain consistency and accuracy across all chains and withdrawal types, Fordefi standardizes on a fixed precision of 18 decimals when representing asset balances on exchanges and during withdrawals.
For example:
- For 1 SOL:
1000000000000000000
(even though SOL has 9 decimal places natively) - For 1 USDC:
1000000000000000000
(even though USDC has 6 decimal places on Ethereum)
Deposits into an exchange vault are regular on-chain transactions. Therefore, when depositing into an exchange vault, use the native decimal places of the deposited asset on the source chain. For example:
- For 1 SOL:
1000000000
- For 1 USDC:
1000000
- For 1 ETH:
1000000000000000000
In withdrawal operations, the value
object supports an optional is_net_amount
flag:
is_net_amount: true
→ fees are added on top of the specified transfer amount, so you'll receive exactly the amount you specify.is_net_amount: false
(or omitted) → fees are deducted from the specified amount.
Examples
Deposits
This example shows how to deposit SOL on Solana from a regular Fordefi Solana vault to a Binance exchange vault. Note that the to
field is set to the Binance exchange vault's ID.
{
"signer_type": "api_signer",
"type": "solana_transaction",
"vault_id": "2d16514e-93c6-42b9-b618-00bfa559445a", // your regular Fordefi Solana Vault ID
"details": {
"type": "solana_transfer",
"to": "5a15271f-a320-43cc-9d16-ed5bafd5b4ae", // your Binance Exchange Vault ID
"asset_identifier": {
"type": "solana",
"details": {
"type": "native",
"chain": "solana_mainnet"
}
},
"value": {
"type": "value",
"value": "10000" // 0.00001 SOL (using its NATIVE 9-decimal precision)
}
}
}
Withdrawals
To withdraw from an exchange vault, set the transaction type
to exchange_transaction
and the to
field to: {"address": "0x1234...", "type": "address"}
when withdrawing to an external address and to {"vault_id": "2d16514e-93c6-42b9-b618-00bfa559445a","type": "vault"}
when withdrawing to a regular Fordefi vault or to another exchange vault.
Below are some examples of transaction requests for:
- Withdrawal from Binance to a regular Fordefi vault (SOL on Solana)
- Withdrawal from Coinbase to an external address (USDC on Ethereum)
- Withdrawal from Coinbase to Binance (USDC on Ethereum)
{
"signer_type": "api_signer",
"type": "exchange_transaction",
"vault_id": "5a15271f-a320-43cc-9d16-ed5bafd5b4ae", // your Binance Exchange Vault ID
"details": {
"type": "external_withdraw",
"chain": "solana_mainnet",
"to": {
"address": "EjL8jgiEMwuHT6xsDwm7HmF4uqv2cAjJULfXwUm6ZSSD", // your regular Fordefi Solana Vault address
"type": "address"
},
"asset_identifier": {
"asset_symbol": "SOL",
"exchange_type": "binance",
"type": "exchange"
},
"value": {
"type": "value",
"value": "1000000000000000000", // 1 SOL (using 18-decimal precision)
"is_net_amount": true // Fee charged on top of this amount
}
}
}