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. It returns a list of transactions from the account encoded in the authenticated JWT.
Throws a RequestErrorException if the server responds with an error and corresponding error message. Throws a SEP24AuthenticationRequiredException if the server responds with an authentication_required error.
Implementation
Future<SEP24TransactionsResponse> transactions(
SEP24TransactionsRequest request) async {
Uri serverURI =
Util.appendEndpointToUrl(_transferServiceAddress, 'transactions');
_AnchorTransactionsRequestBuilder requestBuilder =
_AnchorTransactionsRequestBuilder(httpClient, serverURI);
final Map<String, String> queryParams = {
"asset_code": request.assetCode,
};
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.lang!;
}
SEP24TransactionsResponse response;
try {
response = await requestBuilder
.forQueryParameters(queryParams)
.execute(request.jwt);
} on ErrorResponse catch (e) {
if (e.code == 403) {
_handleForbiddenResponse(e);
} else if (e.code != 200) {
_handleErrorResponse(e);
}
throw e;
}
return response;
}