Preview Transaction
Check transaction details and fees before broadcasting it to the network
API Endpoints
USDT: POST /client/wallets/send/token/preview
TRON: POST /client/wallets/send/tron/preview
LN-BTC: POST /client/wallets/send/ln/preview
Request Headers:
Authorization: Bearer <access_token>
Content-Type: application/json
Request Body:
{
"wallet": "<wallet_uuid>", // the source wallet uuid
"destination" : "TDmx..Fx68" // Only for TRX or USDT withdrawal
"amount": 20000000 // Only for TRX or USDT amount in SUN based (20 x 1000000)
"paymentRequest": "LNINVOICE..." // Only for Case of Bitcoin LN Invoice
}
Success Response: If the OTP is enabled (success.data.isOTP: true), broadcasting the transaction will require an OTP to be authorized. Note that 1 TRX = 1000000 SUN. Amounts are denominate in SUN, for both USDT and TRX, which means you have to divide the amounts by 1,000,000 for user presentation.
Example Below:
{
"success": {
"message": "Transfer Preview",
"data": {
"source": "TNQ...i2N",
"destination": "TDmx..Fx68",
"amount": 86000000, // Sending Raw Amount, to be divided by 1000000
"requiredEnergy": 0, // Energy Required - In case of USDT
"availableEnergy": 0, // Energy Available - In case of USDT
"requiredBandwidthPoints": 100, // Bandwith Required
"availableBandwidthPoints": 600, // Bandwith Available
"feeSUN": 1100000, // TRX Fees, divide feeSUN by 1000000
"sunCostForBandwidth": 100000, // Bandwith Fees Cost in SUN
"sunCostForEnergy": 0,
"accRes": {
"freeNetLimit": 600,
"TotalNetLimit": 43200000000,
"TotalNetWeight": 84632720284,
"TotalEnergyLimit": 50000000000000,
"TotalEnergyWeight": 564258045519
},
"dstRes": {},
// Additional case of TRX account creation
// first time TRX received on new TRON Address destination
"sunCostForAccountCreation": 1000000,
"isOTP": true
}
},
"uuid": "4f49d932-fae5-479e-b8dd-0c8aee0be833"
}
curl 'https://apis.xpay.stream/client/wallets/send/tron/preview' \
-H 'Authorization: Bearer eyJhbGciO...RCf0' \
-H 'Content-Type: application/json' \
--data-raw '{"wallet":"<wallet_uuid>","destination":"<destination_address>","amount":<amount_sun_based>}'
// npm i cross-fetch
const fetch = require("cross-fetch");
const API_URL = "https://apis.xpay.stream/client/wallets/find";
const method = "POST";
const headers = {
"Content-Type": "application/json",
"Authorization: "Bearer <access_token>"
};
const body = JSON.stringify({
"wallet": "698...cba", // wallet uuid
"destination": "TDmx..Fx68", // to TRX address
"amount": 86000000 // 86 USDT or TRX amount in SUN (x10000000)
});
fetch(API_URL, { headers, body, method })
.then(async res => await res.json())
.then(result => {
if(result.error)
console.log("Transaction Preview Done", result);
if(result.success)
console.log("Transaction Preview Error", result);
})
.catch((err) => {
console.error("Transaction Preview API Exception", err);
});
Last updated