Transaction.fromBytes constructor

Transaction.fromBytes(
  1. Uint8List chainTag,
  2. Uint8List blockRef,
  3. Uint8List expiration,
  4. List clauses,
  5. Uint8List gasPriceCoef,
  6. Uint8List gas,
  7. Uint8List dependsOn,
  8. Uint8List nonce,
  9. List<Uint8List>? reserved,
)

Implementation

Transaction.fromBytes(
    Uint8List chainTag,
    Uint8List blockRef,
    Uint8List expiration,
    List clauses,
    Uint8List gasPriceCoef,
    Uint8List gas,
    Uint8List dependsOn,
    Uint8List nonce,
    List<Uint8List>? reserved) {
  this.chainTag.fromBytes(chainTag);
  this.blockRef.fromBytes(blockRef);
  this.expiration.fromBytes(expiration);

  List<Clause> _clauses = [];
  for (List c in clauses) {
    var to = Uint8List.fromList(c[0].cast<int>());
    var value = Uint8List.fromList(c[1].cast<int>());
    var data = Uint8List.fromList(c[2].cast<int>());

    _clauses.add(Clause.fromBytes(to, value, data));
  }

  this.clauses = _clauses;

  this.gasPriceCoef.fromBytes(gasPriceCoef);
  this.gas.fromBytes(gas);
  this.dependsOn.fromBytes(dependsOn);
  this.nonce.fromBytes(nonce);
  if (reserved != null) {
    if (reserved.isNotEmpty) {
      this.reserved = Reserved.unpack(reserved);
    } else {
      this.reserved = Reserved.getNullReserved();
    }
  } else {
    this.reserved = Reserved.getNullReserved();
  }
}