wip: prepare extrinsic revocation

This commit is contained in:
poka 2022-09-06 12:14:50 +02:00
parent f46acb23e4
commit 8663186a4a
1 changed files with 10 additions and 5 deletions

View File

@ -842,19 +842,24 @@ newKeySig: $newKeySig""");
Future revokeIdentity(String address, String password) async {
final idtyIndex = await _getIdentityIndexOf(address);
final sender = await _setSender(address);
TxInfoData txInfo;
final prefix = '?'.codeUnits;
final genesisHashString = await getGenesisHash();
final genesisHash = HEX.decode(genesisHashString.substring(2)) as Uint8List;
final idtyIndexBytes = _int32bytes(idtyIndex);
final oldPubkey = await addressToPubkey(address);
final messageToSign =
Uint8List.fromList(prefix + genesisHash + idtyIndexBytes + oldPubkey);
final revocationSig = await _signMessage(messageToSign, address, password);
txInfo = TxInfoData(
final txInfo = TxInfoData(
'identity',
'revokeIdentity',
sender,
);
final txOptions = [idtyIndex];
final txOptions = [idtyIndex, address, revocationSig];
return await _executeCall(txInfo, txOptions, password);
}