getHistory method

  1. @override
Future<List<TxInfo>> getHistory(
  1. String address
)
override

Implementation

@override
Future<List<TxInfo>> getHistory(String address) async {
  final url = _url('/address/$address/txs');
  final data = await _getJson(url) as List;
  return data.map((e) {
    final m = Map<String, dynamic>.from(e as Map);
    final status = m['status'] as Map<String, dynamic>?;
    return TxInfo(
      txid: m['txid'] as String,
      blockHeight: status?['block_height'] as int?,
      blockHash: status?['block_hash'] as String?,
      fee: m['fee'] != null ? BigInt.from(m['fee'] as num) : null,
      timestamp: status?['block_time'] as int?,
    );
  }).toList();
}