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
4d027e05
Commit
4d027e05
authored
2 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
fix: import scanned wallets
parent
6af9199a
No related branches found
No related tags found
1 merge request
!27
Import cs accounts
Pipeline
#16781
waiting for manual action
Stage: format
Stage: build_and_test
Stage: package
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/providers/generate_wallets.dart
+4
-2
4 additions, 2 deletions
lib/providers/generate_wallets.dart
lib/providers/substrate_sdk.dart
+41
-46
41 additions, 46 deletions
lib/providers/substrate_sdk.dart
with
45 additions
and
48 deletions
lib/providers/generate_wallets.dart
+
4
−
2
View file @
4d027e05
...
@@ -409,7 +409,9 @@ class GenerateWalletsProvider with ChangeNotifier {
...
@@ -409,7 +409,9 @@ class GenerateWalletsProvider with ChangeNotifier {
?
'currentWallet'
.
tr
()
?
'currentWallet'
.
tr
()
:
'
${'wallet'.tr()}
${scanedValidWalletNumber + 1}
'
;
:
'
${'wallet'.tr()}
${scanedValidWalletNumber + 1}
'
;
await
sub
.
importAccount
(
await
sub
.
importAccount
(
derivePath:
'//
$derivationNbr
'
,
password:
pin
.
text
);
mnemonic:
generatedMnemonic
!
,
derivePath:
'//
$derivationNbr
'
,
password:
pin
.
text
);
WalletData
myWallet
=
WalletData
(
WalletData
myWallet
=
WalletData
(
version:
dataVersion
,
version:
dataVersion
,
...
@@ -445,7 +447,7 @@ class GenerateWalletsProvider with ChangeNotifier {
...
@@ -445,7 +447,7 @@ class GenerateWalletsProvider with ChangeNotifier {
"
${addressData.address!}
:
${balance['transferableBalance']}
$currencyName
"
);
"
${addressData.address!}
:
${balance['transferableBalance']}
$currencyName
"
);
if
(
balance
[
'transferableBalance'
]
!=
0
)
{
if
(
balance
[
'transferableBalance'
]
!=
0
)
{
String
walletName
=
'myRootWallet'
.
tr
();
String
walletName
=
'myRootWallet'
.
tr
();
await
sub
.
importAccount
(
password:
pin
.
text
);
await
sub
.
importAccount
(
mnemonic:
generatedMnemonic
!
,
password:
pin
.
text
);
WalletData
myWallet
=
WalletData
(
WalletData
myWallet
=
WalletData
(
version:
dataVersion
,
version:
dataVersion
,
...
...
This diff is collapsed.
Click to expand it.
lib/providers/substrate_sdk.dart
+
41
−
46
View file @
4d027e05
...
@@ -370,52 +370,6 @@ class SubstrateSdk with ChangeNotifier {
...
@@ -370,52 +370,6 @@ class SubstrateSdk with ChangeNotifier {
return
nodeParams
;
return
nodeParams
;
}
}
Future
csToV2
(
String
salt
,
String
password
)
async
{
final
scrypt
=
pc
.
KeyDerivator
(
'scrypt'
);
scrypt
.
init
(
pc
.
ScryptParameters
(
4096
,
16
,
1
,
32
,
Uint8List
.
fromList
(
salt
.
codeUnits
),
),
);
final
rawSeed
=
scrypt
.
process
(
Uint8List
.
fromList
(
password
.
codeUnits
));
final
rawSeedHex
=
'0x
${HEX.encode(rawSeed)}
'
;
// final newAddress1 = await sdk.api.keyring.addressFromRawSeed(ss58,
// cryptoType: CryptoType.ed25519, rawSeed: '0x$rawSeedString');
// log.d('csconvert address: ${newAddress1.address}');
final
json
=
await
sdk
.
api
.
keyring
.
importAccount
(
keyring
,
keyType:
KeyType
.
rawSeed
,
key:
rawSeedHex
,
name:
'test'
,
password:
'password'
,
derivePath:
''
,
cryptoType:
CryptoType
.
ed25519
)
.
catchError
((
e
)
{
importIsLoading
=
false
;
notifyListeners
();
});
final
keypair
=
await
sdk
.
api
.
keyring
.
addAccount
(
keyring
,
keyType:
KeyType
.
rawSeed
,
acc:
json
!
,
password:
password
,
);
await
sdk
.
api
.
keyring
.
deleteAccount
(
keyring
,
keypair
);
// final keypair2 = KeyPairData.fromJson(json as Map<String, dynamic>);
log
.
d
(
keypair
.
address
);
}
Future
<
String
>
importAccount
(
Future
<
String
>
importAccount
(
{
String
mnemonic
=
''
,
{
String
mnemonic
=
''
,
String
derivePath
=
''
,
String
derivePath
=
''
,
...
@@ -593,6 +547,47 @@ class SubstrateSdk with ChangeNotifier {
...
@@ -593,6 +547,47 @@ class SubstrateSdk with ChangeNotifier {
return
await
sdk
.
api
.
keyring
.
checkMnemonicValid
(
mnemonic
);
return
await
sdk
.
api
.
keyring
.
checkMnemonicValid
(
mnemonic
);
}
}
Future
csToV2
(
String
salt
,
String
password
)
async
{
final
scrypt
=
pc
.
KeyDerivator
(
'scrypt'
);
scrypt
.
init
(
pc
.
ScryptParameters
(
4096
,
16
,
1
,
32
,
Uint8List
.
fromList
(
salt
.
codeUnits
),
),
);
final
rawSeed
=
scrypt
.
process
(
Uint8List
.
fromList
(
password
.
codeUnits
));
final
rawSeedHex
=
'0x
${HEX.encode(rawSeed)}
'
;
// Just get the address without keystore
// final newAddress1 = await sdk.api.keyring.addressFromRawSeed(ss58,
// cryptoType: CryptoType.ed25519, rawSeed: '0x$rawSeedString');
// log.d('csconvert address: ${newAddress1.address}');
final
json
=
await
sdk
.
api
.
keyring
.
importAccount
(
keyring
,
keyType:
KeyType
.
rawSeed
,
key:
rawSeedHex
,
name:
'test'
,
password:
'password'
,
derivePath:
''
,
cryptoType:
CryptoType
.
ed25519
);
final
keypair
=
await
sdk
.
api
.
keyring
.
addAccount
(
keyring
,
keyType:
KeyType
.
rawSeed
,
acc:
json
!
,
password:
password
,
);
await
sdk
.
api
.
keyring
.
deleteAccount
(
keyring
,
keypair
);
// final keypair2 = KeyPairData.fromJson(json as Map<String, dynamic>);
log
.
d
(
keypair
.
address
);
}
//////////////////////////////////////
//////////////////////////////////////
///////// 5: CALLS EXECUTION /////////
///////// 5: CALLS EXECUTION /////////
//////////////////////////////////////
//////////////////////////////////////
...
...
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