Estimate TRX
Estimate the TRX required to buy Energy or Bandwidth for a given amount and rental duration before creating a signed-transaction order.
Get an estimate of the TRX needed to buy a resource. Call this endpoint first in the signed-transaction flow to learn the unitPrice, the estimateTrx to pay, and how much resource is actually available to fill your order.
POST https://api.tronsave.io/v2/estimate-buy-resource
Headers
Content-Type
application/json
Yes
Request params
resourceAmount*
Number
The number of resources.
unitPrice
String, Number
"FAST", "MEDIUM", "SLOW", or number:
-"FAST": If the market is ready to fill = 100%, FAST = MEDIUM. If the market is ready to fill < 100%, FAST = MEDIUM + 10. If market ready to fill = 0%, FAST = SLOW + 20.
-"MEDIUM": The lowest price for the maximum market fill for this order. If market is ready to fill = 0%, MEDIUM = SLOW + 10.
-"SLOW": The lowest price that can be set for this order.
-If the price is a number, the price unit is equal to SUN
durationSec
Number
The duration of the bought resource, time unit, is in seconds. Default 3d
requester
String
The address of requester.
receiver
String
The address of receiver resource.
resourceType
String
"ENERGY" or "BANDWIDTH", default: "ENERGY"
options
Object
optional
options.allowPartialFill
Boolean
Allow the order to be filled partially or not
options.minResourceDelegateRequiredAmount
Number
The minimum resource amount delegated by a single provider.
Request body example
Responses
Success
The estimateTrx value is returned in SUN (1 TRX = 1,000,000 SUN). unitPrice is the per-unit price in SUN, and availableResource is how much of the requested resource the market can fill.
Error
Because this endpoint authenticates via the signed transaction (not an API key), it does not return a 401 response for missing credentials. The most common error is schema validation when a required field is missing or invalid. The message names of the offending field.
400 Bad Request — validation (missing required resourceAmount):
404 Not Found — wrong route/path:
Request examples
Next steps
Back to Buy with Signed Transaction
Last updated