RClause constructor

RClause(
  1. String to, {
  2. Contract? contract,
  3. String? functionName,
  4. List? functionParameters,
  5. BigInt? value,
})

Implementation

RClause(String to,
    {this.contract,
    this.functionName,
    List? functionParameters,
    BigInt? value}) {
  value ??= BigInt.zero;
  isCall = contract != null && functionName != null;

  if (isCall) {
    var f = contract!.getFunctionByName(functionName!);
    var data = f.encode(functionParameters!);

    clause = {
      "to": to,
      "value": value.toString(),
      "data": "0x" + bytesToHex(data)
    };
  } else {
    clause = {"to": to, "value": value.toString(), "data": "0x"};
  }
}