Create Order
tronsave_create_orderCreate a buy order for ENERGY/BANDWIDTH delegated to orderReceiver. SPENDS FUNDS — confirm the plan with the user first. API-key integrations paying from the internal balance can instead use tronsave_internal_order_create (FAST/MEDIUM/SLOW pricing, fill guards). Inputs: orderResourceType, orderReceiver, orderUnitPrice (SUN, not TRX), orderDurationSec, orderResourceAmount, paymentPaymentAmount (SUN), and paymentMethod: internal — debits the TronSave internal balance (needs an api-key login/header or a signature login whose wallet has an internal account); onchain — no login needed, but paymentSignedTx must be the user's wallet-signed TRX transfer to systemDepositAddress. Take price/amount/duration values from the latest tronsave_estimate_buy_resource. Returns { success, message, code, data.orderId } — check success; verify with tronsave_get_order or tronsave_list_orders. Not idempotent: on a timeout, verify before retrying to avoid duplicate orders.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"orderResourceType": "<orderResourceType>",
"orderReceiver": "<orderReceiver>",
"orderUnitPrice": "<orderUnitPrice>",
"orderDurationSec": "<orderDurationSec>",
"orderResourceAmount": "<orderResourceAmount>",
"paymentMethod": "<paymentMethod>",
"paymentPaymentAmount": "<paymentPaymentAmount>"
},
"name": "tronsave_create_order"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orderReceiver | Yes | TRON base58 address (starts with T) that receives delegated resource. Same as `receiver` passed to `tronsave_estimate_buy_resource`. | |
| paymentMethod | Yes | Payment method for this order: `onchain` (wallet signed tx) or `internal` (internal balance). | |
| orderUnitPrice | Yes | Unit price in SUN per resource unit (NOT TRX). Use `unitPrice` from the latest `tronsave_estimate_buy_resource` for the same receiver, amount, and duration. | |
| paymentSignedTx | No | Required when `paymentMethod=onchain`: the user's wallet-signed TRX transfer of `paymentPaymentAmount` SUN to `systemDepositAddress` (from `tronsave_estimate_buy_resource`), TronWeb shape `{ txID, raw_data, raw_data_hex, signature[] }`. Must be produced client-side by the user's wallet; never fabricate or hand-edit. | |
| orderDurationSec | Yes | Delegation duration in seconds. Must match the `durationSec` used in `tronsave_estimate_buy_resource`. | |
| orderResourceType | Yes | Resource to buy: ENERGY (smart contracts) or BANDWIDTH (transactions). Must match `tronsave_estimate_buy_resource`. | |
| orderResourceAmount | Yes | Amount of ENERGY or BANDWIDTH units to purchase. Same as `buyResourceAmount` in estimate when applicable. | |
| paymentPaymentAmount | Yes | Total payment in SUN (1 TRX = 1e6 SUN). Use `estimateTrx` (SUN) from the latest `tronsave_estimate_buy_resource`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | GraphQL mutation status code (HTTP-like; `0`/`200` indicates success). Always pair with `success` for routing. | |
| data | No | ||
| message | No | Human-readable status text. Populated even on success; localized error messages may appear here on failure. | |
| success | No | Whether the mutation succeeded at the backend level. Always check this before reading `data`. |