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
506110cf
Commit
506110cf
authored
2 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
use binary concatenation instead of string
parent
d42e7154
No related branches found
No related tags found
1 merge request
!27
Import cs accounts
Pipeline
#16832
failed
2 years ago
Stage: format
Stage: build_and_test
Stage: package
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/providers/substrate_sdk.dart
+21
-15
21 additions, 15 deletions
lib/providers/substrate_sdk.dart
lib/screens/home.dart
+0
-2
0 additions, 2 deletions
lib/screens/home.dart
with
21 additions
and
17 deletions
lib/providers/substrate_sdk.dart
+
21
−
15
View file @
506110cf
...
...
@@ -2,7 +2,6 @@
import
'dart:typed_data'
;
import
'package:easy_localization/easy_localization.dart'
;
import
'package:fast_base58/fast_base58.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gecko/globals.dart'
;
import
'package:gecko/models/chest_data.dart'
;
...
...
@@ -282,14 +281,13 @@ class SubstrateSdk with ChangeNotifier {
return
genesisHash
;
}
Future
<
String
>
addressToPubkey
(
String
address
,
[
bool
toBase58
=
false
])
async
{
Future
<
Uint8List
>
addressToPubkey
(
String
address
)
async
{
final
pubkey
=
await
sdk
.
api
.
account
.
decodeAddress
([
address
]);
final
String
pubkeyHex
=
pubkey
!.
keys
.
first
;
final
pubkeyByte
=
HEX
.
decode
(
pubkeyHex
.
substring
(
2
))
as
Uint8List
;
final
pubkey58
=
Base58Encode
(
pubkeyByte
);
//
final pubkey58 = Base58Encode(pubkeyByte);
return
toBase58
?
pubkey58
:
pubkeyHex
;
return
pubkeyByte
;
}
// Future pubkeyToAddress(String pubkey) async {
...
...
@@ -784,7 +782,7 @@ class SubstrateSdk with ChangeNotifier {
}
Future
<
String
>
signMessage
(
String
message
,
String
address
,
String
password
)
async
{
Uint8List
message
,
String
address
,
String
password
)
async
{
final
params
=
SignAsExtensionParam
();
params
.
msgType
=
"pub(bytes.sign)"
;
params
.
request
=
{
...
...
@@ -817,13 +815,26 @@ class SubstrateSdk with ChangeNotifier {
// final destKeyring = getKeypair(destAddress);
// await sdk.api.keyring.signatureVerify(message, signature, address)
final
genesisHash
=
await
getGenesisHash
();
final
idtyIndex
=
await
getIdentityIndexOf
(
fromAddress
);
final
oldPubkey
=
await
addressToPubkey
(
fromAddress
,
true
);
final
messageToSign
=
'icok
$genesisHash$idtyIndex$oldPubkey
'
;
final
prefix
=
'icok'
.
codeUnits
;
final
genesisHash
=
(
await
getGenesisHash
())
.
substring
(
2
)
.
codeUnits
;
final
idtyIndex
=
[
await
getIdentityIndexOf
(
fromAddress
)];
final
oldPubkey
=
await
addressToPubkey
(
fromAddress
);
// final messageToSign = 'icok$genesisHash$idtyIndex$oldPubkey';
final
messageToSign
=
Uint8List
.
fromList
(
prefix
+
genesisHash
+
idtyIndex
+
oldPubkey
);
final
newKeySig
=
await
signMessage
(
messageToSign
,
destAddress
,
destPassword
);
log
.
d
(
"""
prefix:
$prefix
genesisHash:
$genesisHash
idtyIndex:
$idtyIndex
oldPubkey:
$oldPubkey
messageToSign:
$messageToSign
newKeySig:
$newKeySig
"""
);
// [105, 99, 111, 107, 48, 55, 99, 49, 49, 50, 102, 102, 54, 97, 98, 57, 100, 55, 100, 48, 100, 53, 51, 49, 101, 98, 101, 53, 57, 102, 57, 56, 98, 51, 53, 51, 49, 56, 98, 50, 56, 49, 51, 98, 49, 54, 53, 53, 53, 55, 55, 51, 56, 48, 56, 49, 57, 100, 51, 56, 100, 54, 49, 56, 50, 100, 57, 57, 21, 181, 82, 178, 99, 198, 4, 156, 190, 78, 35, 102, 137, 255, 7, 162, 31, 16, 79, 255, 132, 130, 237, 230, 222, 176, 88, 245, 217, 237, 78, 196, 239]
// [105, 99, 111, 107, 48, 55, 99, 49, 49, 50, 102, 102, 54, 97, 98, 57, 100, 55, 100, 48, 100, 53, 51, 49, 101, 98, 101, 53, 57, 102, 57, 56, 98, 51, 53, 51, 49, 56, 98, 50, 56, 49, 51, 98, 49, 54, 53, 53, 53, 55, 55, 51, 56, 48, 56, 49, 57, 100, 51, 56, 100, 54, 49, 56, 50, 100, 57, 57, 21, 181, 82, 178, 99, 198, 4, 156, 190, 78, 35, 102, 137, 255, 7, 162, 31, 16, 79, 255, 132, 130, 237, 230, 222, 176, 88, 245, 217, 237, 78, 196, 239]
txInfo
=
TxInfoData
(
'identity'
,
'changeOwnerKey'
,
...
...
@@ -838,11 +849,6 @@ class SubstrateSdk with ChangeNotifier {
// rawParams = '[[$tx1, $tx2, $tx3]]';
log
.
d
(
"""g1migration args:
${txInfo.module}
,
${txInfo.call}
,
txOptions:
$txOptions
rawParams:
$rawParams
messageToSign:
$messageToSign
newKeySig:
$newKeySig
"""
);
return
await
executeCall
(
txInfo
,
txOptions
,
formPassword
,
rawParams
);
}
...
...
This diff is collapsed.
Click to expand it.
lib/screens/home.dart
+
0
−
2
View file @
506110cf
...
...
@@ -39,8 +39,6 @@ class HomeScreen extends StatelessWidget {
final
bool
isWalletsExists
=
myWalletProvider
.
checkIfWalletExist
();
// sub.addressToPubkey('5CQ8T4qpbYJq7uVsxGPQ5q2df7x3Wa4aRY6HUWMBYjfLZhnn');
isTall
=
false
;
ratio
=
1
;
if
(
MediaQuery
.
of
(
context
)
.
size
.
height
>
=
930
)
{
...
...
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