getHistoricalActions method
Retrieves historical actions for a smart wallet, with optional filtering by token address and update time.
Parameters:
page
(optional) – The page number to retrieve, default is 1.limit
(optional) – Number of items in each page, default is 10.updatedAt
(optional) – Filter actions updated at or after the specified Unix timestamp.tokenAddress
(optional) – Filter actions related to the specified token address.
Returns a Future that completes with a DC object:
- On success,
DC.data
will be called with an ActionResult object containing the historical actions. - On failure,
DC.error
will be called with anException
object.
Implementation
Future<DC<Exception, ActionResult>> getHistoricalActions({
int page = 1,
int limit = 10,
int? updatedAt,
String? tokenAddress,
}) async {
final Map<String, dynamic> queryParameters = {
'page': page,
'limit': limit,
};
if (tokenAddress != null) {
queryParameters.putIfAbsent('tokenAddress', () => tokenAddress);
}
if (updatedAt != null) {
queryParameters.putIfAbsent('updatedAt', () => updatedAt);
}
try {
final Response response = await _dio.get(
'/v1/smart-wallets/historical_txs',
queryParameters: queryParameters,
options: _options,
);
return DC.data(ActionResult.fromJson(
response.data['data'],
));
} catch (e) {
return DC.error(Exception(e.toString()));
}
}