transactions method

The transaction history endpoint helps anchors enable a better experience for users using an external wallet. With it, wallets can display the status of deposits and withdrawals while they process and a history of past transactions with the anchor. It's only for transactions that are deposits to or withdrawals from the anchor.

Implementation

Future<AnchorTransactionsResponse> transactions(
    AnchorTransactionsRequest request) async {
  Uri serverURI =
      Util.appendEndpointToUrl(_transferServiceAddress, 'transactions');

  _AnchorTransactionsRequestBuilder requestBuilder =
      _AnchorTransactionsRequestBuilder(httpClient, serverURI);

  final Map<String, String> queryParams = {
    "asset_code": request.assetCode,
    "account": request.account
  };

  if (request.noOlderThan != null) {
    queryParams["no_older_than"] = request.noOlderThan!.toIso8601String();
  }

  if (request.limit != null) {
    queryParams["limit"] = request.limit.toString();
  }

  if (request.kind != null) {
    queryParams["kind"] = request.kind!;
  }

  if (request.pagingId != null) {
    queryParams["paging_id"] = request.pagingId!;
  }

  if (request.lang != null) {
    queryParams["lang"] = request.kind!;
  }

  AnchorTransactionsResponse response = await requestBuilder
      .forQueryParameters(queryParams)
      .execute(request.jwt);

  return response;
}