getTransaction method

  1. @override
Future<TxInfo> getTransaction(
  1. String txid
)
override

Implementation

@override
Future<TxInfo> getTransaction(String txid) async {
  final result = await _rpc(
    'blockchain.transaction.get',
    [txid, true],
  );
  final m = Map<String, dynamic>.from(result as Map);
  return TxInfo(
    txid: m['txid'] as String,
    blockHeight: m['confirmations'] != null && (m['confirmations'] as int) > 0
        ? m['height'] as int?
        : null,
    blockHash: m['blockhash'] as String?,
    timestamp: m['time'] as int?,
  );
}