getAccountTransactions method
Get account transactions Retrieves on-chain committed transactions from an account. If the start version is too far in the past, a 410 will be returned. If no start version is given, it will start at version 0. To retrieve a pending transaction, use /transactions/by_hash.
Parameters:
address
- Address of account with or without a0x
prefixstart
- Account sequence number to start list of transactions If not provided, defaults to showing the latest transactionslimit
- Max number of transactions to retrieve. If not provided, defaults to default page sizecancelToken
- ACancelToken
that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- AValidateStatus
callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- AProgressCallback
that can be used to get the send progressonReceiveProgress
- AProgressCallback
that can be used to get the receive progress
Returns a Future containing a Response
with a BuiltList<Transaction>
as data
Throws DioError
if API call or serialization fails
Implementation
Future<Response<BuiltList<Transaction>>> getAccountTransactions({
required String address,
String? start,
int? limit,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/accounts/{address}/transactions'
.replaceAll('{' r'address' '}', address.toString());
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (start != null)
r'start':
encodeQueryParameter(_serializers, start, const FullType(String)),
if (limit != null)
r'limit':
encodeQueryParameter(_serializers, limit, const FullType(int)),
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
BuiltList<Transaction>? _responseData;
try {
final rawResponse = _response.data;
_responseData = rawResponse == null
? null
: _serializers.deserialize(
rawResponse,
specifiedType: const FullType(BuiltList, [FullType(Transaction)]),
) as BuiltList<Transaction>;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<BuiltList<Transaction>>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}