Tron API En
Chinese API
  • Basic information
  • Tron API
    • Get related configuration
    • Pre-order
    • create trx engerg order
    • create usdt engerg order
    • create bandwidth order
    • upload purchase order hash
    • create a sell order
    • Earn energy by stake
    • recovered energy
    • cancel order
    • query purchase order
    • query recent finished order
    • query purchase order records by user address
    • query sell order records by user address
  • Seller Tron API
    • Get seller configuration
    • Seller authorization
    • Update seller configuration
    • Get seller panel
  • Buyer Tron API
    • Get buyer configuration
    • Buyer charge
    • Buyer withdraw
    • Buyer leas energy
    • Buyer leas energy records
    • Buyer asset records
  • FAQ
    • Error Code
Powered by GitBook
On this page
  • Endpoint usage
  • code example
  • Postman example
  1. Tron API

create trx engerg order

create engergy purchase order

Endpoint usage

POST https://open.tronify.io/api/tronRent/addTronRentRecord

The fields with * are required, and the fields without * are optional

Request Body

Name
Type
Description

fromAddress*

String

user address(wallet address for buyer)

pledgeAddress*

String

energy receiving address.

pledgeNum*

int

amount of energy

orderPrice

String

price(unit: sun)

When tradeType is equal to "freedom," it is optional and needs to be greater than 30

default:95

When tradeType is equal to "fastTrade" or "EnenryTreasure," it is not need.

orderType*

String

ENERGY

sourceFlag*

String

Source channel (Both sides need to agree on a name to represent the channel of the third parties)

tradeType

String

[freedom,

fastTrade,

EnenryTreasure]

default: freedom

pledgeDay

String

Rental Time(unit: day)

When tradeType is equal to "freedom," it is required. values: 3-30

When tradeType is equal to "fastTrade" or "EnenryTreasure," it is optional. values: 1-30

( pledgeDay, pledgeHour, and pledgeMinute cannot be empty simultaneously)

pledgeHour

String

Rental Time(unit: hour)

When tradeType is equal to "fastTrade" or "EnenryTreasure," it is optional.

values: [1, 3]

pledgeMinute

String

Rental Time(unit: minute)

When tradeType is equal to "fastTrade" or "EnenryTreasure," it is optional.

values: [10]

{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "orderId": "16zi4ynw_sdvn_qv8h_ujfc_crfsgyi07zat",
        "platformAddr": "TAdm9uEjiDge14T6AkZuo8vCNBEV1Fitmn",//trx recieving platform address
        "fromAddress": "TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k",//wallet address
        "pledgeAddress": "TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k",//energy recieving address
        "pledgeDay": 3,
        "source": "tronLink",
        "orderType": "ENERGY",
        "orderPrice": 110,
        "pledgeNum": 500,
        "pledgeTrxNum": 0.165
    }
}

code example

// example
const params = {
    fromAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    pledgeAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    tradeType: 'freedom',
    pledgeDay: 3,
    orderType: 'ENERGY',
    orderPrice: 110,
    pledgeNum: 32000,
    sourceFlag: 'tronLink'
}
const res = await axios.post('https://open.tronify.io/api/tronRent/addTronRentRecord',params)
console.log(res)
if(res.resCode === '100'){
    const orderId = res.data.orderId;
    const transaction = res.data.transaction;
    const signedTx = await tronWeb.trx.sign(transaction)
    const params = {
        "orderId": orderId,
        "fromHash": signedTx.txID,
        "signedData": signedTx
    };
    const rest = await axios.post('https://open.tronify.io/api/tronRent/uploadHash', params );
    console.log(rest)
    if(rest.resCode === '100'){
        // ...
    }
}

Postman example

PreviousPre-orderNextcreate usdt engerg order

Last updated 5 days ago