toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  return {
    'transactions': transactions.map((tx) => tx.toJson()).toList(),
    'transactionIds': transactionIds,
    'baseFeePerGas':
        baseFeePerGas != null
            ? '0x${baseFeePerGas!.toRadixString(16)}'
            : null,
    'difficulty': '0x${difficulty.toRadixString(16)}',
    'extraData': extraData,
    'gasLimit': '0x${gasLimit.toRadixString(16)}',
    'gasUsed': '0x${gasUsed.toRadixString(16)}',
    'hash': hash,
    'logsBloom': logsBloom,
    'miner': miner,
    'mixHash': mixHash,
    'nonce': nonce != null ? '0x${nonce!.toRadixString(16)}' : null,
    'number': '0x${number.toRadixString(16)}',
    'parentHash': parentHash,
    'receiptsRoot': receiptsRoot,
    'sha3Uncles': sha3Uncles,
    'size': '0x${size.toRadixString(16)}',
    'stateRoot': stateRoot,
    'timestamp': timestamp,
    'totalDifficulty': totalDifficulty,
    'transactionsRoot': transactionsRoot,
    'uncles': uncles,
    'withdrawals': withdrawals.map((w) => w.toJson()).toList(),
    'withdrawalsRoot': withdrawalsRoot,
  }.notNullValue;
}