Issue description
When using the Fireblocks Gas Station, the base asset wallet in a vault account may retain a minimal balance even if all other token balances have been withdrawn from that vault account. This occurs when there is a difference between the estimated and actual fee amounts during a transaction.
All transactions in Fireblocks require you to specify a custom fee (gasPrice using the API) or select the low, medium, or high fee level. Fireblocks estimates each level’s amount when the transaction is submitted. Learn more about how Fireblocks calculates transaction fees.
Attempting to use the remaining amount of a base asset for the token transfer by setting the transaction’s fee level may not empty the balance. This is because each fee level is an estimation different from the actual fee completed on the blockchain. Therefore, a small amount of the base asset can remain in the asset wallet, even if no other funds are in the vault account.
Resolution
To execute a transaction that uses all remaining funds in a vault account for a base asset, create a transaction using the gross amount and specify a custom fee equal to the remaining balance of the base asset in the vault account. This will set the transaction fee precisely to the desired amount, subtract the transaction fee from the total transfer amount, and withdraw all remaining funds in the vault account.
To create this transaction using the API, use the treatAsGross and gasPrice parameters, with the custom fee set in gwei, to set the gas price to exactly the maxFee. A transaction using these settings doesn’t require setting the priorityFee or maxFee parameters.