identity migration is working

This commit is contained in:
poka 2022-08-20 16:55:55 +02:00
parent 99f939d5a2
commit c840753f4a
3 changed files with 29 additions and 16 deletions

View File

@ -598,7 +598,7 @@ class SubstrateSdk with ChangeNotifier {
return await sdk.api.keyring.checkMnemonicValid(mnemonic); return await sdk.api.keyring.checkMnemonicValid(mnemonic);
} }
Future csToV2Address(String salt, String password) async { Future<String> csToV2Address(String salt, String password) async {
final scrypt = pc.KeyDerivator('scrypt'); final scrypt = pc.KeyDerivator('scrypt');
scrypt.init( scrypt.init(
@ -621,6 +621,7 @@ class SubstrateSdk with ChangeNotifier {
g1V1NewAddress = newAddress.address!; g1V1NewAddress = newAddress.address!;
notifyListeners(); notifyListeners();
return g1V1NewAddress;
} }
Future<List> getBalanceAndIdtyStatus(String address, String myAddress) async { Future<List> getBalanceAndIdtyStatus(String address, String myAddress) async {
@ -801,7 +802,8 @@ class SubstrateSdk with ChangeNotifier {
{required String fromAddress, {required String fromAddress,
required String destAddress, required String destAddress,
required String formPassword, required String formPassword,
required String destPassword}) async { required String destPassword,
bool withBalance = false}) async {
transactionStatus = ''; transactionStatus = '';
final fromPubkey = await sdk.api.account.decodeAddress([fromAddress]); final fromPubkey = await sdk.api.account.decodeAddress([fromAddress]);
final sender = TxSenderData( final sender = TxSenderData(
@ -840,19 +842,28 @@ messageToSign: $messageToSign
messageToSignHex: $messageToSignHex messageToSignHex: $messageToSignHex
newKeySig: $newKeySig"""); newKeySig: $newKeySig""");
txInfo = TxInfoData( if (withBalance) {
'identity', txInfo = TxInfoData(
'changeOwnerKey', 'utility',
sender, 'batchAll',
); sender,
);
txOptions = [destAddress, newKeySig]; const tx1 = 'api.tx.universalDividend.claimUds()';
final tx2 =
'api.tx.identity.changeOwnerKey("$destAddress", "$newKeySig")';
const tx3 = 'api.tx.balances.transferAll(false)';
// const tx1 = 'api.tx.universalDividend.claimUds()'; rawParams = '[[$tx1, $tx2, $tx3]]';
// final tx2 = 'api.tx.identity.changeOwnerKey("$destAddress", "$newKeySig")'; } else {
// const tx3 = 'api.tx.balances.transferAll(false)'; txInfo = TxInfoData(
'identity',
'changeOwnerKey',
sender,
);
// rawParams = '[[$tx1, $tx2, $tx3]]'; txOptions = [destAddress, newKeySig];
}
return await _executeCall(txInfo, txOptions, formPassword, rawParams); return await _executeCall(txInfo, txOptions, formPassword, rawParams);
} }
@ -918,7 +929,8 @@ newKeySig: $newKeySig""");
fromAddress: keypair.address!, fromAddress: keypair.address!,
destAddress: destAddress, destAddress: destAddress,
formPassword: 'password', formPassword: 'password',
destPassword: destPassword); destPassword: destPassword,
withBalance: true);
} else if (balance != 0) { } else if (balance != 0) {
await pay( await pay(
fromAddress: keypair.address!, fromAddress: keypair.address!,

View File

@ -1062,8 +1062,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: gecko-old ref: gecko-unwrapbytes
resolved-ref: "87096351fb187614b6386343615db39a2f2b5b9b" resolved-ref: b019cc2a6e77b6989f94b1bef8259298410cd82a
url: "https://github.com/poka-IT/sdk.git" url: "https://github.com/poka-IT/sdk.git"
source: git source: git
version: "0.4.8" version: "0.4.8"

View File

@ -65,7 +65,8 @@ dependencies:
# url: https://github.com/polkawallet-io/sdk.git # url: https://github.com/polkawallet-io/sdk.git
# ref: develop # ref: develop
url: https://github.com/poka-IT/sdk.git url: https://github.com/poka-IT/sdk.git
ref: gecko-old # ref: gecko-old
ref: gecko-unwrapbytes
dots_indicator: ^2.1.0 dots_indicator: ^2.1.0
web_socket_channel: ^2.2.0 web_socket_channel: ^2.2.0
connectivity_plus: ^2.3.3 connectivity_plus: ^2.3.3