getSubaccountDepositHistory method

Future<Either<String, List<Deposit>>> getSubaccountDepositHistory({
  1. required String email,
  2. String? coin,
  3. int? status,
  4. int? startTime,
  5. int? endTime,
  6. int? limit,
  7. int? offset,
  8. int? recvWindow,
})

Fetch Sub-account Deposit History (For Master Account)

Implementation

Future<Either<String, List<Deposit>>> getSubaccountDepositHistory({
  required String email,
  String? coin,
  int? status,
  int? startTime,
  int? endTime,
  int? limit,
  int? offset,
  int? recvWindow,
}) {
  Map<String, String> params = {
    'email': email,
  };
  if (coin != null) params['coin'] = coin;
  if (status != null) params['status'] = status.toString();
  if (startTime != null) params['startTime'] = startTime.toString();
  if (endTime != null) params['endTime'] = endTime.toString();
  if (limit != null) params['limit'] = limit.toString();
  if (offset != null) params['offset'] = offset.toString();
  if (recvWindow != null) params['recvWindow'] = recvWindow.toString();
  return sendRequest(
    path: 'sapi/v1/capital/deposit/subHisrec',
    type: RequestType.GET,
    params: params,
    keyRequired: true,
    signatureRequired: true,
    timestampRequired: true,
  ).then((r) => r.isLeft
      ? Left(r.left)
      : Right(List<Deposit>.from(r.right.map((e) => Deposit.fromMap(e)))));
}