Calculate task-expiry-time & task-automation-fee
View the command
supra move automation register --help
Understand parameters
supra move automation register \
--task-max-gas-amount XXXX \
--task-gas-price-cap XXX \
--task-expiry-time-secs XXXXXXXXXX \
--task-automation-fee-cap XXXXXXXXXX \
--function-id "0xYourAddress::your_module::function_name" \
--rpc-url <TESTNET or MAINNET>
How to Calculate --task-expiry-time-secs
Supra tasks only run after the next epoch. Here’s how to calculate it.
Get the last epoch start
curl -X 'GET' \
'https://rpc-testnet.supra.com/rpc/v2/accounts/1/resources/0x1%3A%3Areconfiguration%3A%3AConfiguration' \
-H 'accept: application/json'
Look for Something like:
"last_reconfiguration_time": "1747163851854115"
Above Number is in microseconds, you have to convert it into Seconds before calculating the task expiry time via the formula given. Example: 1747163851854115 Microseconds -> 1747163851 Seconds
Final Formula to Calculate Task Expiry Time: (Add a buffer of 300 = 5 mins or 120 = 2 mins)
buffer
is the duration that you wish to set the automation task to run for. Please note that the max duration that your task may be registered for is 7 days from the time of registration.
task-expiry-time-secs =
(last_reconfiguration_time/1000000) + (epoch_interval/1000000) + buffer
Example:
task-expiry-time-secs = 1748027985 + 7200 + 300 = 1748035485
Use:
--task-expiry-time-secs 1748035485
How to Estimate the --task-automation-fee-cap
Use this endpoint to estimate the automation execution fee:
curl --request POST \
--url https://rpc-testnet.supra.com/rpc/v2/view \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"function": "0x1::automation_registry::estimate_automation_fee",
"type_arguments": [],
"arguments": ["50000"]
}'
Example:
{"result":["1440000000"]}
This means:
--task-automation-fee-cap 1440000000
Parameter Guide
--task-max-gas-amount
Max gas your function can use
--task-gas-price-cap
Max gas price per unit to avoid spikes
--task-expiry-time-secs
Deadline for task (UNIX time)
--task-automation-fee-cap
Max fee (in microSUPRA) for automation
--function-id
Target public entry function to trigger
--args (optional, per target function)
Arguments to pass to the function
--task-max-gas-amount
Run a dry run to check for success
task_duration_cap_in_secs
Maximum allowable duration (in seconds) from the registration time that an automation task can run, If the expiration time exceeds this duration, the task registration will fail.
registry_max_gas_cap
Maximum gas allocation for automation tasks per epoch, exceeding this limit during task registration will cause failure and is used in fee calculation.
automation_base_fee_in_quants_per_sec
Base fee per second for the full capacity of the automation registry, measured in quants/sec. The capacity is considered full if the total committed gas of all registered tasks equals registry_max_gas_cap.
flat_registration_fee_in_quants
Flat registration fee charged by default for each task.
congestion_threshold_percentage
Relative to registry_max_gas_cap. Beyond this threshold, congestion fees apply.
congestion_base_fee_in_quants_per_sec
Base fee per second for the full capacity of the automation registry when the congestion threshold is exceeded.
congestion_exponent
The congestion fee increases exponentially based on this value, ensuring higher fees as the registry approaches full capacity
task_capacity
Maximum number of tasks that registry can hold
Last updated