Skip to content
Snippets Groups Projects
Commit 8c20491e authored by poka's avatar poka
Browse files

upgrade deps and fix unclaimedUds if not membre

parent 7de21473
No related branches found
No related tags found
No related merge requests found
Pipeline #39308 failed
...@@ -45,8 +45,15 @@ class PolkadotProvider with ChangeNotifier { ...@@ -45,8 +45,15 @@ class PolkadotProvider with ChangeNotifier {
final int currentUdIndex = int.parse((await promiseToFuture(getCurrentUdIndexJS())).toString()); final int currentUdIndex = int.parse((await promiseToFuture(getCurrentUdIndexJS())).toString());
final List pastReevals = (await promiseToFuture(getPastReevalsJS())); final List pastReevals = (await promiseToFuture(getPastReevalsJS()));
final idtyStatus = mapStatus[idtyData?['status']] ?? IdentityStatus.none;
// Compute amount of claimable UDs // Compute amount of claimable UDs
final int unclaimedUds = _computeUnclaimUds(currentUdIndex, idtyData?['data']?['firstEligibleUd'] ?? 0, pastReevals); final int unclaimedUds = _computeUnclaimUds(
currentUdIndex: currentUdIndex,
firstEligibleUd: idtyData?['data']?['firstEligibleUd'] ?? 0,
pastReevals: pastReevals,
idtyStatus: idtyStatus,
);
// Calculate transferable and potential balance // Calculate transferable and potential balance
final int transferableBalance = (balanceGlobal['free'] + unclaimedUds); final int transferableBalance = (balanceGlobal['free'] + unclaimedUds);
...@@ -61,24 +68,29 @@ class PolkadotProvider with ChangeNotifier { ...@@ -61,24 +68,29 @@ class PolkadotProvider with ChangeNotifier {
return finalBalances; return finalBalances;
} }
int _computeUnclaimUds(int currentUdIndex, int firstEligibleUd, List pastReevals) { int _computeUnclaimUds({
required int currentUdIndex,
required int firstEligibleUd,
required List pastReevals,
required IdentityStatus idtyStatus,
}) {
int totalAmount = 0; int totalAmount = 0;
if (firstEligibleUd == 0) return 0; if (firstEligibleUd == 0 || idtyStatus != IdentityStatus.member) return 0;
for (final List reval in pastReevals.reversed) { for (final List reval in pastReevals.reversed) {
final int revalNbr = reval[0]; final int udIndex = reval[0];
final int revalValue = reval[1]; final int udValue = reval[1];
// Loop each UDs revaluations and sum unclaimed balance // Loop each UDs revaluations and sum unclaimed balance
if (revalNbr <= firstEligibleUd) { if (udIndex <= firstEligibleUd) {
final count = currentUdIndex - firstEligibleUd; final count = currentUdIndex - firstEligibleUd;
totalAmount += count * revalValue; totalAmount += count * udValue;
break; break;
} else { } else {
final count = currentUdIndex - revalNbr; final count = currentUdIndex - udIndex;
totalAmount += count * revalValue; totalAmount += count * udValue;
currentUdIndex = revalNbr; currentUdIndex = udIndex;
} }
} }
...@@ -211,11 +223,6 @@ class PolkadotProvider with ChangeNotifier { ...@@ -211,11 +223,6 @@ class PolkadotProvider with ChangeNotifier {
} }
} }
Future updateListMyWallets(Map account) async {
// log.d('tataaii: ' + account['address']);
final int? idtyIndex = await getIdentityIndex(account['address']);
final Map? idtyData = idtyIndex == null ? null : json.decode((await promiseToFuture(getIdentityDataJS(idtyIndex))).toString());
final mapStatus = { final mapStatus = {
null: IdentityStatus.none, null: IdentityStatus.none,
'Unconfirmed': IdentityStatus.unconfirmed, 'Unconfirmed': IdentityStatus.unconfirmed,
...@@ -226,6 +233,11 @@ class PolkadotProvider with ChangeNotifier { ...@@ -226,6 +233,11 @@ class PolkadotProvider with ChangeNotifier {
'unknown': IdentityStatus.unknown, 'unknown': IdentityStatus.unknown,
}; };
Future updateListMyWallets(Map account) async {
// log.d('tataaii: ' + account['address']);
final int? idtyIndex = await getIdentityIndex(account['address']);
final Map? idtyData = idtyIndex == null ? null : json.decode((await promiseToFuture(getIdentityDataJS(idtyIndex))).toString());
final newAccountData = WalletData( final newAccountData = WalletData(
address: account['address'], address: account['address'],
name: account['meta']?['name'] ?? 'unnamed', name: account['meta']?['name'] ?? 'unnamed',
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ name: gecko_web ...@@ -2,7 +2,7 @@ name: gecko_web
description: "Ğecko web" description: "Ğecko web"
publish_to: "none" publish_to: "none"
version: 0.0.8+25 version: 0.0.9+26
environment: environment:
sdk: ">=2.17.1 <3.0.0" sdk: ">=2.17.1 <3.0.0"
...@@ -10,7 +10,7 @@ environment: ...@@ -10,7 +10,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.8
qr_flutter: #^4.0.0 qr_flutter: #^4.0.0
git: git:
url: https://github.com/insinfo/qr.flutter.git url: https://github.com/insinfo/qr.flutter.git
...@@ -18,30 +18,30 @@ dependencies: ...@@ -18,30 +18,30 @@ dependencies:
truncate: ^3.0.1 truncate: ^3.0.1
hive: ^2.2.3 hive: ^2.2.3
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
graphql_flutter: ^5.2.0-beta.1 graphql_flutter: ^5.2.0-beta.8
provider: ^6.0.1 provider: ^6.1.2
easy_localization: ^3.0.1 easy_localization: ^3.0.7
logger: ^2.0.0 logger: ^2.5.0
flutter_svg: ^2.0.4 flutter_svg: ^2.0.16
package_info_plus: ^8.0.0 package_info_plus: ^8.1.2
auto_route: ^9.2.2 auto_route: ^9.2.2
accordion: ^2.5.1 accordion: ^2.6.0
flutter_portal: ^1.1.3 flutter_portal: ^1.1.4
device_info_plus: ^10.1.0 device_info_plus: ^11.2.0
url_launcher: ^6.1.10 url_launcher: ^6.3.1
fade_and_translate: ^0.1.3 fade_and_translate: ^0.1.3
hex: ^0.2.0 hex: ^0.2.0
http: ^1.1.2 http: ^1.2.2
uuid: ^4.4.2 uuid: ^4.5.1
google_fonts: ^6.2.1 google_fonts: ^6.2.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^4.0.0 flutter_lints: ^5.0.0
icons_launcher: ^3.0.0 icons_launcher: ^3.0.0
auto_route_generator: ^9.0.0 auto_route_generator: ^9.0.0
build_runner: ^2.3.3 build_runner: ^2.4.13
flutter_icons: flutter_icons:
web: true web: true
......
#!/usr/bin/env python3
from ruamel.yaml import YAML
# Define the file paths
pubspec_yaml_path = "pubspec.yaml"
pubspec_lock_path = "pubspec.lock"
# Initialize YAML parser/loader
yaml = YAML()
yaml.preserve_quotes = True
yaml.indent(mapping=2, sequence=4, offset=2)
# Read the pubspec.lock file and extract the package versions
lock_versions = {}
with open(pubspec_lock_path, 'r') as lock_file:
lock_data = yaml.load(lock_file)
for package_name, package_info in lock_data['packages'].items():
lock_versions[package_name] = package_info['version']
# Read the pubspec.yaml file
with open(pubspec_yaml_path, 'r') as yaml_file:
yaml_data = yaml.load(yaml_file)
# Function to preserve formatting and update versions
def update_dependency_versions(dependencies_section):
if not dependencies_section:
return
for package, details in dependencies_section.items():
# Skip if it's an SDK, Git, or path dependency
if any(key in details for key in ['sdk', 'git', 'path']):
continue
# Update version if the package exists in lock_versions
if package in lock_versions:
dependencies_section[package] = "^" + lock_versions[package]
# Update the dependency versions in pubspec.yaml
update_dependency_versions(yaml_data.get('dependencies', {}))
update_dependency_versions(yaml_data.get('dev_dependencies', {}))
# Write the updated data back to pubspec.yaml
with open(pubspec_yaml_path, 'w') as yaml_file:
yaml.dump(yaml_data, yaml_file)
print("pubspec.yaml has been updated with versions from pubspec.lock.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment