质押获得能量

接口调用

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

以下参数带*字段为必填,不带*号为选填

Request Body

Name
Type
Description

saleAddress*

String

用户地址(创建质押交易的钱包地址)

sourceFlag*

String

渠道来源(需要双方约定一个名称来代表三方的渠道)

payTrxNum*

String

质押trx数量

orderType*

String

订单类型(ENERGY/BANDWIDTH)

{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "visible": false,
        "txID": "05694544c56863032625dce3554e62220fd4b36d32172fd125d255123e4a0826",
        "raw_data": {
            "contract": [
                {
                    "parameter": {
                        "value": {
                            "resource": "ENERGY",
                            "frozen_balance": 400000000,
                            "owner_address": "41dcf5a07cfac1534c2410714d6ba6576f49c4a6d7"
                        },
                        "type_url": "type.googleapis.com/protocol.FreezeBalanceV2Contract"
                    },
                    "type": "FreezeBalanceV2Contract"
                }
            ],
            "ref_block_bytes": "717a",
            "ref_block_hash": "8fb56414b12b26fe",
            "expiration": 1682088777000,
            "timestamp": 1682088718991
        },
        "raw_data_hex": "0a02717a22088fb56414b12b26fe40a8aab7a2fa305a5b083612570a34747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e63655632436f6e7472616374121f0a1541dcf5a07cfac1534c2410714d6ba6576f49c4a6d7108088debe011801708fe5b3a2fa30"
    }
}

调用示例

// example
const params = {
    saleAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    orderType: 'ENERGY',
    payTrxNum: 111,
    sourceFlag: 'tronLink'
}
 const res = await axios.post('https://open.tronify.io/api/tronRent/createfreezeBalanceTransaction',params)
 console.log(res)
 if(res.resCode === '100'){
    const signedTx = await tronWeb.trx.sign(res.data)
    const broastTx = await tronWeb.trx.sendRawTransaction(signedTx)
    return broastTx.txid
 }

Postman 示例

Last updated