from static method

TronTriggerSmartContractData from(
  1. TriggerSmartContract contract
)
override

Implementation

static TronTriggerSmartContractData from(
  TriggerSmartContract contract,
) {
  final owner = base58CheckFromHex(contract.ownerAddress.toUint8List);
  final contractAddress =
      base58CheckFromHex(contract.contractAddress.toUint8List);

  final data = contract.data.toUint8List;
  final functionSelector = getFunctionSelectorFromData(data);

  return switch (functionSelector) {
    TronTRC20TransferContractData.selector =>
      TronTRC20TransferContractData.fromPB(
        data,
        ownerAddress: owner,
        contractAddress: contractAddress,
      ),
    _ => throw UnsupportedError(
        "Unsupported Contract Type: $functionSelector with $contract",
      ),
  };
}