Enabling and Disabling Auto-Fueling
Overview
Vault account auto-fueling is always available for API users with the Gas Station enabled, and any vault account with the Gas Station badge in the Console participates in the Gas Station service.
- When an incoming token transaction to an auto-fueling vault account completes, Fireblocks automatically transfers the appropriate base asset from the Gas Station to the vault account. This is because the auto-fueled vault account must have a token with a non-zero balance on the relevant network where you are expecting an auto-fueling transaction.
- When an outgoing transaction from an auto-fueling vault account completes, Fireblocks checks the token and gas balance. The vault account is refueled if the token balance is above 0.00001 and the base asset is below the set threshold. Token transfers from this vault account to any destination will then have sufficient gas to cover transaction fees.
Enabling auto-fueling in the Console
For new vault accounts, select Auto-fuel with gas after an incoming transaction completes when you create the account.
For existing vault accounts, go to My Funds > Accounts, find the appropriate vault account, and then select More Actions (...) > Enable Auto-Fueling > Enable. The Gas Station badge appears next to the name of the vault account when you're done.
Enabling auto-fueling via the API
For new vault accounts, call the Create a new vault account endpoint and set the autoFuel field to true.
For existing vault accounts:
- Call the List vault accounts (paginated) endpoint to find the vault account's ID.
- Call the Turn auto-fueling on or off endpoint, enter the vault account's ID in the vaultAccountId field, and then set the autoFuel field to true.
Disabling auto-fueling in the Console
In the Fireblocks Console, go to My Funds > Accounts, find the appropriate vault account, and then select More Actions (...) > Disable Auto-Fueling > Disable. The Gas Station badge is removed when you're done.
Disabling auto-fueling via the API
- Call the List vault accounts (paginated) endpoint to find the ID of the vault account.
- Call the Turn auto-fueling on or off endpoint, enter the vault account's ID in the vaultAccountId field, and then set the autoFuel field to false.
Testing auto-fueling
To test, add this function to the code you should already have if you followed the language-specific guides under the Developing with Fireblocks section. This example sets the auto-fuel boolean to true for vault account ID 0.
const setAutoFuel = async (vaultAccountId: string, autoFuel: boolean) => {
try {
const setAutofuel = await fireblocks.vaults.setVaultAccountAutoFuel({
setAutoFuelRequest: {
autoFuel: autoFuel,
},
vaultAccountId: vaultAccountId,
});
console.log(JSON.stringify(setAutofuel.data, null, 2));
} catch (error: any) {
console.error(error);
}
};
setAutoFuel("0", true);
async function setAutoFuel(vaultAccountId, autoFuel){
const setAutofuel = await fireblocks.setAutoFuel(vaultAccountId, autoFuel);
console.log(JSON.stringify(setAutofuel, null, 2));
}
setAutoFuel(“0”, true);
def set_auto_fuel(vault_account_id: str, auto_fuel: bool) -> str:
return fireblocks.set_auto_fuel(vault_account_id, auto_fuel)
auto_fuel_status = set_auto_fuel("0", True)
Updated 6 months ago