diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 7662ef1..d6366e9 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -1,75 +1,75 @@
-
- CADisableMinimumFrameDurationOnPhone
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleDisplayName
- Realt Apps
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- realt_apps
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- $(FLUTTER_BUILD_NAME)
- CFBundleSignature
- ????
- CFBundleVersion
- $(FLUTTER_BUILD_NUMBER)
- LSApplicationQueriesSchemes
-
- https
-
- LSRequiresIPhoneOS
-
- NSCameraUsageDescription
- This app needs access to the camera to scan QR codes for adding wallet addresses.
- NSDocumentsFolderUsageDescription
- Nous avons besoin d'accéder à vos documents pour sauvegarder et charger les fichiers.
- NSPhotoLibraryUsageDescription
- Cette application utilise la bibliothèque de photos pour permettre aux utilisateurs de sélectionner et d'envoyer des images.
- UIApplicationSupportsIndirectInputEvents
-
- NSLocationWhenInUseUsageDescription
- This app requires access to your location to provide location-based services.
- UIBackgroundModes
-
- processing
- remote-notification
- fetch
-
- BGTaskSchedulerPermittedIdentifiers
-
- com.example.realtApps.backgroundtask
-
- UILaunchStoryboardName
- LaunchScreen
- UIMainStoryboardFile
- Main
- UIStatusBarHidden
-
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UISupportedInterfaceOrientations~ipad
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UIViewControllerBasedStatusBarAppearance
-
-
+
+ CADisableMinimumFrameDurationOnPhone
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleDisplayName
+ Realt Apps
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ realt_apps
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(FLUTTER_BUILD_NAME)
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ $(FLUTTER_BUILD_NUMBER)
+ LSApplicationQueriesSchemes
+
+ https
+
+ LSRequiresIPhoneOS
+
+ NSCameraUsageDescription
+ This app needs access to the camera to scan QR codes for adding wallet addresses.
+ NSDocumentsFolderUsageDescription
+ Nous avons besoin d'accéder à vos documents pour sauvegarder et charger les fichiers.
+ NSPhotoLibraryUsageDescription
+ Cette application utilise la bibliothèque de photos pour permettre aux utilisateurs de sélectionner et d'envoyer des images.
+ UIApplicationSupportsIndirectInputEvents
+
+ NSLocationWhenInUseUsageDescription
+ This app requires access to your location to provide location-based services.
+ UIBackgroundModes
+
+ processing
+ remote-notification
+ fetch
+
+ BGTaskSchedulerPermittedIdentifiers
+
+ com.example.realtApps.backgroundtask
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UIStatusBarHidden
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UIViewControllerBasedStatusBarAppearance
+
+
diff --git a/lib/api/api_service.dart b/lib/api/api_service.dart
index 661d348..ca377e0 100644
--- a/lib/api/api_service.dart
+++ b/lib/api/api_service.dart
@@ -673,4 +673,83 @@ class ApiService {
return [];
}
}
+
+ static Future> fetchTokenVolumes({bool forceFetch = false}) async {
+ logger.i("apiService: fetchTokenVolumes -> Lancement de la requête");
+
+ var box = Hive.box('realTokens');
+ final lastFetchTime = box.get('lastTokenVolumesFetchTime');
+ final DateTime now = DateTime.now();
+
+ // Vérifiez si le cache est valide
+ if (!forceFetch && lastFetchTime != null) {
+ final DateTime lastFetch = DateTime.parse(lastFetchTime);
+ if (now.difference(lastFetch) < Parameters.apiCacheDuration) {
+ final cachedData = box.get('cachedTokenVolumesData');
+ if (cachedData != null) {
+ logger.i("apiService: fetchTokenVolumes -> Requête annulée, cache valide");
+ return json.decode(cachedData);
+ }
+ }
+ }
+
+ // Définition des variables pour la requête GraphQL
+ const List stables = [
+ "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
+ "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
+ "0x7349c9eaa538e118725a6130e0f8341509b9f8a0"
+ ];
+ final String limitDate = DateTime.now().subtract(Duration(days: 30)).toIso8601String().split('T').first;
+
+ // Envoyer la requête GraphQL
+ final response = await http.post(
+ Uri.parse(Parameters.yamUrl),
+ headers: {'Content-Type': 'application/json'},
+ body: json.encode({
+ "query": '''
+ query GetTokenVolumes(\$stables: [String!], \$limitDate: String!) {
+ tokens(first: 1000) {
+ id
+ decimals
+ volumes(where: { token_in: \$stables }) {
+ token {
+ decimals
+ }
+ volumeDays(orderBy: date, orderDirection: desc, where: { date_gte: \$limitDate }) {
+ date
+ quantity
+ volume
+ }
+ }
+ }
+ }
+ ''',
+ "variables": {
+ "stables": stables,
+ "limitDate": limitDate,
+ }
+ }),
+ );
+
+ if (response.statusCode == 200) {
+ logger.i("apiService: fetchTokenVolumes -> Requête lancée avec succès");
+
+ final decodedResponse = json.decode(response.body);
+ if (decodedResponse['data'] != null && decodedResponse['data']['tokens'] != null) {
+ final List tokens = decodedResponse['data']['tokens'];
+
+ // Mettre les données dans le cache
+ box.put('cachedTokenVolumesData', json.encode(tokens));
+ box.put('lastTokenVolumesFetchTime', now.toIso8601String());
+ box.put('lastExecutionTime_TokenVolumes', now.toIso8601String());
+
+ return tokens;
+ } else {
+ logger.w("apiService: fetchTokenVolumes -> Aucune donnée disponible");
+ return [];
+ }
+ } else {
+ throw Exception('apiService: fetchTokenVolumes -> Échec de la requête');
+ }
+ }
}
diff --git a/lib/api/data_manager.dart b/lib/api/data_manager.dart
index b4b0216..848b428 100644
--- a/lib/api/data_manager.dart
+++ b/lib/api/data_manager.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'dart:convert';
@@ -93,6 +95,7 @@ class DataManager extends ChangeNotifier {
int rentedUnits = 0;
int totalUnits = 0;
double initialTotalValue = 0.0;
+ double yamTotalValue = 0.0;
double totalTokens = 0.0;
double walletTokensSums = 0.0;
double rmmTokensSums = 0.0;
@@ -151,8 +154,9 @@ class DataManager extends ChangeNotifier {
List