Skip to main content
Version: 6.0.4

DeserializeTransaction() <src>

Deserialize a transaction, convert raw data hex into an object.

Usage

utils.transaction.DeserializeTransaction(type, rawDataHex)

Parameters

ArgumentDescriptionType
typeThe transaction type.string
typeThe raw data hex of a transaction.string

Note: In TronWeb v6.0.2, we used to deserialize a triggerSmartContract type transaction by DTriggerSmartContract. But we give a unified API to deserialize transactions with any type in this version. And DTriggerSmartContract no longer exists.

Supported type

  • TriggerSmartContract
  • FreezeBalanceV2Contract
  • UnfreezeBalanceV2Contract
  • CancelAllUnfreezeV2Contract
  • DelegateResourceContract
  • UnDelegateResourceContract
  • WithdrawExpireUnfreezeContract

Return

Object - An object with the transaction data.

Example

import { TronWeb, utils } from 'tronweb';

const tronWeb = new TronWeb({
fullHost: 'https://api.nileex.io',
privateKey: 'your private key',
});
const contractAddress = 'TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf'; // nile usdt address
const account = await tronWeb.createAccount();
const account2 = await tronWeb.createAccount();
const tx = (await tronWeb.transactionBuilder.triggerSmartContract(
contractAddress,
'transfer(address,uint256)',
{
txLocal: true,
tokenId: '1000008',
tokenValue: 100,
feeLimit: 100 * (10 ** 6),
},
[
{ type: "address", value: account2.address.base58 },
{ type: "uint256", value: 100000000 }
],
account.address.base58,
)).transaction;
const dResult = utils.transaction.DeserializeTransaction('TriggerSmartContract', tx.raw_data_hex);