Sell resource
TIP
API Method
POST /v2/order/delegate
Request params
Field | Position | Type | Required | Description |
---|---|---|---|---|
order_no | body | string | true | Order No. |
settle_address | body | string | true | Settlement to the wallet address |
resource_value | body | integer | true | Resource quantity |
signed_txn | body | SignedTransaction | true | Signed transaction, Note that it is a json object |
Request params example
{
"order_no": "2304177020986224644402",
"settle_address": "THm1oFPxG8PLVg31wpjZiYg8nkvEbUDeUS",
"resource_value": 8220000,
"signed_txn": {
"visible": false,
"txID": "f9a4122de21a8071ee1c5bb673d09373c01ed432428b8bf476ef93cfa3c7bd55",
"raw_data": {
"contract": [{
"parameter": {
"value": {
"balance": 488768000000,
"resource": "ENERGY",
"receiver_address": "41b36efab2013f6211bd7fc95e78eb13806fbfb820",
"lock": true,
"lock_period": 403200,
"owner_address": "415572a99430cd7d13219013e7c1921d70418c29d3"
},
"type_url": "type.googleapis.com/protocol.DelegateResourceContract"
},
"type": "DelegateResourceContract"
}],
"ref_block_bytes": "dac4",
"ref_block_hash": "1ad5a51debe627dd",
"expiration": 1681776240000,
"timestamp": 1681776182655
},
"raw_data_hex": "0a02dac422081ad5a51debe627dd4080cbb38df9305a76083912720a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e44656c65676174655265736f75726365436f6e747261637412390a15415572a99430cd7d13219013e7c1921d70418c29d310011880a0dfe69c0e221541b36efab2013f6211bd7fc95e78eb13806fbfb820280170ff8ab08df930",
"useTronHeader": true,
"signature": ["xxxxxxxxx"],
"signType": 0
}
}
Responses
Field | Type | Required | Description |
---|---|---|---|
code | integer | true | Response code |
msg | string | true | Code description |
request_id | string | true | |
data | Object | false | |
» tx | Object | false | |
» » transaction_hash | string | false | Delegate transaction hash |
» » bandwidth_point | integer | false | Consume bandwidth |
» » result | Object | false | Broadcast results |
» » » result | bool | false | |
» » » code | integer | false | |
» order | SellerOrderDetail | false | Seller Order Details |
Response example
{
"code": 0,
"msg": "ok",
"request_id": "2a27fb90-3a8a-4c27-8d8d-eef27a35f160",
"data": {
"tx": {
"transaction_hash": "2beda6734f433181c84a29b1529d885de0f8fe3bf3be4febfd3a2cb144eb0384",
"bandwidth_point": 281,
"result": {
"result": true
}
},
"order": {
"order_no": "2304190664759388169206",
"order_type": 0,
"resource_type": 1,
"owner_address": "",
"receive_address": "TGGnzPi2DST6aeZPcKeLaqVKuFCj777777",
"price_in_sun": 105,
"min_amount": 100000,
"min_payout": 23.625,
"min_freeze": 484,
"max_amount": 399989,
"max_payout": 94.497401,
"max_freeze": 1936,
"freeze_time": 1681913707,
"unfreeze_time": 0,
"create_time": 1681911320,
"resource_value": 500000,
"resource_split_value": 100000,
"frozen_resource_value": 100011,
"rent_duration": 3,
"rent_time_unit": "d",
"rent_expire_time": 1682172907,
"frozen_balance": 2420,
"frozen_tx_id": "",
"settle_amount": 0,
"settle_address": "",
"settle_time": 0,
"status": 15
}
}
}
Code demo
curl --location --request POST 'https://feee.io/open/v2/order/delegate' \
--header 'key: <key>' \
--header 'User-Agent: Feee.io Client/1.0.0 (https://feee.io)' \
--header 'Content-Type: application/json' \
--data-raw '<body data here>'
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://feee.io/open/v2/order/delegate"
method := "POST"
payload := strings.NewReader(`<body data here>`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("key", "<key>")
req.Header.Add("User-Agent", "Feee.io Client/1.0.0 (https://feee.io)")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://feee.io/open/v2/order/delegate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'<body data here>',
CURLOPT_HTTPHEADER => array(
'key: <key>',
'User-Agent: Feee.io Client/1.0.0 (https://feee.io)',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json
conn = http.client.HTTPSConnection("feee.io")
payload = "<body data here>"
headers = {
'key': '<key>',
'User-Agent': 'Feee.io Client/1.0.0 (https://feee.io)',
'Content-Type': 'application/json'
}
conn.request("POST", "/open/v2/order/delegate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "<body data here>");
Request request = new Request.Builder()
.url("https://feee.io/open/v2/order/delegate")
.method("POST", body)
.addHeader("key", "<key>")
.addHeader("User-Agent", "Feee.io Client/1.0.0 (https://feee.io)")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();