POSTExchangeTransaction

Tron Mainnethttps://tron-mainnet.nodit.io/wallet/exchangetransaction

Create a transaction that swaps tokens on an exchange pair. The price follows the Bancor algorithm, and the transaction fails when the amount received is lower than expected.

Request Body
owner_addressstringrequired

Transaction initiator address. (Format: Base58 or Hex)

exchange_idinteger (int64)required

Unique ID of the exchange pair. Example: 1

token_idstringrequired

ID of the token to sell. Use _ for TRX.

quantinteger (int64)required

Amount of the token to sell. TRX amounts are in sun.

expectedinteger (int64)required

Minimum amount of the counterpart token to receive. The transaction fails if the actual amount is lower.

visibleboolean

Optional. Set to true to format addresses in Base58; set to false for hex format. (Default: false)

Permission_idinteger

Optional. Permission ID used for multi-signature account operations. Defaults to the owner permission (0) if unspecified.

Responses
txIDstring

Transaction ID (hash).

raw_dataobject

The transaction raw_data (contract, ref_block_*, expiration, etc.).

raw_data_hexstring

Hex-encoded protobuf of raw_data.

visibleboolean

Echoes back the visible value given in the request.

X-API-KEY
RequestCU30
cURL
curl -X POST "https://tron-mainnet.nodit.io/wallet/exchangetransaction" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
  "owner_address": "TUoHaVjx7n5xz8LwPRDckgFrDWhMhuSuJM",
  "exchange_id": 1,
  "token_id": "_",
  "quant": 100,
  "expected": 10,
  "visible": true
}'
Response
Example · 200
{
  "txID": "string",
  "raw_data": {},
  "raw_data_hex": "string",
  "visible": true
}