fetchTxs static method

Future<Map?> fetchTxs(
  1. SubScanRequestParams para
)

Implementation

static Future<Map?> fetchTxs(SubScanRequestParams para) async {
  String url = '${getSnEndpoint(para.network!)}/extrinsics';
  Map params = {
    "page": para.page,
    "row": para.row,
    "module": para.module,
  };
  if (para.address != null) {
    params['address'] = para.address;
  }
  if (para.call != null) {
    params['call'] = para.call;
  }
  String body = jsonEncode(params);
  Response res =
      await post(Uri.parse(url), headers: post_headers, body: body);
  if (res.body != null) {
    final obj = await compute(jsonDecode, res.body);
    if (para.sendPort != null) {
      para.sendPort!.send(obj['data']);
    }
    return obj['data'];
  }
  if (para.sendPort != null) {
    para.sendPort!.send({});
  }
  return {};
}