Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğecko web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
Ğecko web
Commits
8c20491e
Commit
8c20491e
authored
5 months ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
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
5 months ago
Stage: test
Changes
4
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/providers/polkadot.dart
+32
-20
32 additions, 20 deletions
lib/providers/polkadot.dart
pubspec.lock
+134
-118
134 additions, 118 deletions
pubspec.lock
pubspec.yaml
+16
-16
16 additions, 16 deletions
pubspec.yaml
scripts/update_pubsec_yaml_versions.py
+47
-0
47 additions, 0 deletions
scripts/update_pubsec_yaml_versions.py
with
229 additions
and
154 deletions
lib/providers/polkadot.dart
+
32
−
20
View file @
8c20491e
...
@@ -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
reval
Value
=
reval
[
1
];
final
int
ud
Value
=
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
*
reval
Value
;
totalAmount
+=
count
*
ud
Value
;
break
;
break
;
}
else
{
}
else
{
final
count
=
currentUdIndex
-
revalNbr
;
final
count
=
currentUdIndex
-
udIndex
;
totalAmount
+=
count
*
reval
Value
;
totalAmount
+=
count
*
ud
Value
;
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.
Click to expand it.
pubspec.lock
+
134
−
118
View file @
8c20491e
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
16
−
16
View file @
8c20491e
...
@@ -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
+2
5
version
:
0.0.
9
+2
6
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
:
^1
0.1
.0
device_info_plus
:
^1
1.2
.0
url_launcher
:
^6.
1
.1
0
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.1
3
flutter_icons
:
flutter_icons
:
web
:
true
web
:
true
...
...
This diff is collapsed.
Click to expand it.
scripts/update_pubsec_yaml_versions.py
0 → 100644
+
47
−
0
View file @
8c20491e
#!/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.
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment