TronTRC20TransferContractData.fromPB constructor

TronTRC20TransferContractData.fromPB(
  1. Uint8List data, {
  2. required String ownerAddress,
  3. required String contractAddress,
})

Implementation

factory TronTRC20TransferContractData.fromPB(
  Uint8List data, {
  required String ownerAddress,
  required String contractAddress,
}) {
  final paramData = decodeParams(
    data.sublist(4),
    [TronParameterType.ADDRESS, TronParameterType.INT256],
  );

  final recipient = paramData[0] as TronAddressParameter;
  final amount = paramData[1] as TronIntParameter;

  return TronTRC20TransferContractData(
    recipient: recipient.value,
    ownerAddress: "",
    contractAddress: "",
    amount: Amount(value: amount.value, decimals: 6),
  );
}