getTransactionByBlockHashAndIndex method
Get transaction by block hash and index. Returns information about a transaction by block hash and transaction index position. Hash of a block and integer of the transaction index position. Returns see getTransactionByHash.
Implementation
Future<MoacTransaction> getTransactionByBlockHashAndIndex(
BigInt blockHash, int index) async {
if (blockHash == null) {
throw ArgumentError.notNull(
"Moac::getTransactionByBlockHashAndIndex - blockHash");
}
if (index == null) {
throw ArgumentError.notNull(
"Moac::getTransactionByBlockHashAndIndex - index");
}
final dynamic params = [
MoacUtilities.bigIntegerToHex(blockHash),
MoacUtilities.intToHex(index)
];
final String method = MoacRpcMethods.getTransactionByBlockHashAndIndex;
final res = await rpcClient.request(method, params);
if (res != null && res.containsKey(moacResultKey)) {
return MoacTransaction.fromMap(res[moacResultKey]);
}
_processError(method, res);
return null;
}