TransactionReceipt.fromMap constructor

TransactionReceipt.fromMap(
  1. Map<String, dynamic> map
)

Implementation

TransactionReceipt.fromMap(Map<String, dynamic> map)
  : transactionHash = hexToBytes(map['transactionHash'] as String),
    transactionIndex = hexToDartInt(map['transactionIndex'] as String),
    blockHash = hexToBytes(map['blockHash'] as String),
    blockNumber =
        map['blockNumber'] != null
            ? BlockNum.exact(int.parse(map['blockNumber'] as String))
            : const BlockNum.pending(),
    from =
        map['from'] != null
            ? XCBAddress.fromHex(map['from'] as String)
            : null,
    to = map['to'] != null ? XCBAddress.fromHex(map['to'] as String) : null,
    cumulativeEnergyUsed = hexToInt(map['cumulativeEnergyUsed'] as String),
    energyUsed =
        map['energyUsed'] != null
            ? hexToInt(map['energyUsed'] as String)
            : null,
    effectiveEnergyPrice =
        map['effectiveEnergyPrice'] != null
            ? XCBAmount.inOre(
              BigInt.parse(map['effectiveEnergyPrice'] as String),
            )
            : null,
    contractAddress =
        map['contractAddress'] != null
            ? XCBAddress.fromHex(map['contractAddress'] as String)
            : null,
    status =
        map['status'] != null
            ? (hexToDartInt(map['status'] as String) == 1)
            : null,
    logs =
        map['logs'] != null
            ? (map['logs'] as List<dynamic>)
                .map(
                  (log) => FilterEvent.fromMap(log as Map<String, dynamic>),
                )
                .toList()
            : [];