Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğecko
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
Commits
b916c44d
Commit
b916c44d
authored
1 year ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
refacto: add methods to WalletData
parent
1b1c5ab7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/models/wallet_data.dart
+18
-0
18 additions, 0 deletions
lib/models/wallet_data.dart
lib/providers/substrate_sdk.dart
+3
-10
3 additions, 10 deletions
lib/providers/substrate_sdk.dart
lib/screens/myWallets/wallet_options.dart
+10
-22
10 additions, 22 deletions
lib/screens/myWallets/wallet_options.dart
with
31 additions
and
32 deletions
lib/models/wallet_data.dart
+
18
−
0
View file @
b916c44d
...
...
@@ -61,6 +61,24 @@ class WalletData extends HiveObject {
return
"
$chest
:
$number
:
$name
:
$derivation
:
$imageDefaultPath
"
;
}
bool
hasIdentity
()
{
return
identityStatus
==
IdtyStatus
.
created
||
identityStatus
==
IdtyStatus
.
confirmed
||
identityStatus
==
IdtyStatus
.
validated
;
}
bool
isMembre
()
{
return
identityStatus
==
IdtyStatus
.
validated
;
}
bool
exist
()
{
return
balance
!=
0
;
}
bool
hasCustomImage
()
{
return
imageCustomPath
!=
null
;
}
// returns only the id part of the ':'-separated string
List
<
int
?
>
id
()
{
return
[
chest
,
number
];
...
...
This diff is collapsed.
Click to expand it.
lib/providers/substrate_sdk.dart
+
3
−
10
View file @
b916c44d
...
...
@@ -311,15 +311,6 @@ class SubstrateSdk with ChangeNotifier {
return
totalAmount
;
}
Future
<
bool
>
isMember
(
String
address
)
async
{
final
isMember
=
await
idtyStatus
(
address
)
==
IdtyStatus
.
validated
;
final
walletData
=
walletBox
.
get
(
address
)
??
WalletData
(
address:
address
);
walletData
.
identityStatus
=
IdtyStatus
.
validated
;
walletBox
.
put
(
address
,
walletData
);
// notifyListeners();
return
isMember
;
}
Future
<
bool
>
isSmithGet
(
String
address
)
async
{
var
idtyIndex
=
await
_getIdentityIndexOf
(
address
);
...
...
@@ -337,7 +328,9 @@ class SubstrateSdk with ChangeNotifier {
Map
<
String
,
int
>
result
=
{};
final
toStatus
=
await
idtyStatus
(
to
);
if
(
from
!=
to
&&
await
isMember
(
from
))
{
final
myWallets
=
MyWalletsProvider
();
if
(
from
!=
to
&&
myWallets
.
getWalletDataByAddress
(
from
)
!.
isMembre
())
{
final
removableOn
=
await
getCertValidityPeriod
(
from
,
to
);
final
certMeta
=
await
getCertMeta
(
from
);
final
int
nextIssuableOn
=
certMeta
[
'nextIssuableOn'
]
??
0
;
...
...
This diff is collapsed.
Click to expand it.
lib/screens/myWallets/wallet_options.dart
+
10
−
22
View file @
b916c44d
...
...
@@ -262,28 +262,16 @@ class WalletOptions extends StatelessWidget {
walletOptions
,
currentChest
),
SizedBox
(
height:
17
*
ratio
),
// walletProvider.isMember(context, _walletOptions.address.text)
FutureBuilder
(
future:
sub
.
isMember
(
walletOptions
.
address
.
text
),
builder:
(
BuildContext
context
,
AsyncSnapshot
<
bool
>
isMember
)
{
if
(
isMember
.
connectionState
!=
ConnectionState
.
done
||
isMember
.
hasError
)
{
return
const
Text
(
''
);
}
return
Column
(
children:
[
if
(
!
walletProvider
.
isDefaultWallet
&&
!
isMember
.
data
!
)
deleteWallet
(
context
,
walletProvider
,
currentChest
)
else
const
SizedBox
(),
if
(
isMember
.
data
!
)
const
ManageMembershipButton
()
]);
}),
Column
(
children:
[
if
(
!
walletProvider
.
isDefaultWallet
&&
!
wallet
.
isMembre
())
deleteWallet
(
context
,
walletProvider
,
currentChest
)
else
const
SizedBox
(),
if
(
wallet
.
isMembre
())
const
ManageMembershipButton
()
])
]);
}),
]),
...
...
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