Create Order
tronsave_create_orderCreate a new buy order on the TronSave market. Key inputs: orderResourceType (ENERGY|BANDWIDTH), orderReceiver (TRON base58), orderUnitPrice in SUN (NOT TRX), orderDurationSec, orderResourceAmount, and paymentMethod: (1) onchain — requires a signed payment tx in paymentSignedTx; (2) internal — deducts from internal balance. Side effect: creates a live order matchable by the market. Requires a signature session and mcp-session-id. Always derive orderUnitPrice and paymentPaymentAmount from the latest tronsave_estimate_buy_resource for the same receiver, amount, and duration to avoid reverts. FRESHNESS: re-quote immediately before submitting — estimates older than a few seconds (one TRON block ≈ 3s) may be stale and cause the order to revert or fill at the wrong price.
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. Prefer aligning with `minResourcePrice` or `buyResourcePrice` from the latest `tronsave_estimate_buy_resource` for the same receiver, amount, and duration. | |
| paymentSignedTx | No | Required when `paymentMethod=onchain`. TronWeb-shaped signed TRON transaction (`{ 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 | Payment amount in SUN. Prefer deriving from `tronsave_estimate_buy_resource`; if converting to TRX, divide SUN by `1e6`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | GraphQL mutation status code (HTTP-like; `0`/`200` indicates success). Always pair with `success` for routing. | |
| data | No | ||
| message | Yes | Human-readable status text. Populated even on success; localized error messages may appear here on failure. | |
| success | Yes | Whether the mutation succeeded at the backend level. Always check this before reading `data`. |