getHistory method

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

Implementation

@override
Future<List<TxInfo>> getHistory(String address) async {
  final scriptHash = _addressToScriptHash(address);
  final result = await _rpc(
    'blockchain.scripthash.get_history',
    [scriptHash],
  );
  return (result as List).map((e) {
    final m = Map<String, dynamic>.from(e as Map);
    final height = m['height'] as int;
    return TxInfo(
      txid: m['tx_hash'] as String,
      blockHeight: height > 0 ? height : null,
      fee: m['fee'] != null ? BigInt.from(m['fee'] as int) : null,
    );
  }).toList();
}