improve batch meca

This commit is contained in:
poka 2022-08-10 07:18:04 +02:00
parent 2526f382f1
commit c487749f52
2 changed files with 8 additions and 15 deletions

View File

@ -506,6 +506,7 @@ class SubstrateSdk with ChangeNotifier {
keyring.current.pubKey, keyring.current.pubKey,
); );
TxInfoData txInfo; TxInfoData txInfo;
List txOptions = [];
if (toIdtyStatus == 'noid') { if (toIdtyStatus == 'noid') {
txInfo = TxInfoData( txInfo = TxInfoData(
@ -513,6 +514,7 @@ class SubstrateSdk with ChangeNotifier {
'createIdentity', 'createIdentity',
sender, sender,
); );
txOptions = [toAddress];
} else if (toIdtyStatus == 'Validated' || } else if (toIdtyStatus == 'Validated' ||
toIdtyStatus == 'ConfirmedByOwner') { toIdtyStatus == 'ConfirmedByOwner') {
if (toCerts[0] >= currencyParameters['wotMinCertForMembership'] && if (toCerts[0] >= currencyParameters['wotMinCertForMembership'] &&
@ -523,12 +525,17 @@ class SubstrateSdk with ChangeNotifier {
'batchAll', 'batchAll',
sender, sender,
); );
txOptions = [
'cert.addCert($fromIndex, $toIndex)',
'identity.validateIdentity($toIndex)'
];
} else { } else {
txInfo = TxInfoData( txInfo = TxInfoData(
'cert', 'cert',
'addCert', 'addCert',
sender, sender,
); );
txOptions = [fromIndex, toIndex];
} }
} else { } else {
transactionStatus = 'cantBeCert'; transactionStatus = 'cantBeCert';
@ -539,20 +546,6 @@ class SubstrateSdk with ChangeNotifier {
log.d('Cert action: ${txInfo.call!}'); log.d('Cert action: ${txInfo.call!}');
try { try {
List txOptions = [];
if (txInfo.call == 'batchAll') {
txOptions = [
'cert.addCert($fromIndex, $toIndex)',
'identity.validateIdentity($toIndex)'
];
} else if (txInfo.call == 'createIdentity') {
txOptions = [toAddress];
} else if (txInfo.call == 'addCert') {
txOptions = [fromIndex, toIndex];
} else {
log.e('TX call is unexpected');
return 'Ğecko says: TX call is unexpected';
}
final hash = await sdk.api.tx final hash = await sdk.api.tx
.signAndSend( .signAndSend(
txInfo, txInfo,

View File

@ -5,7 +5,7 @@ description: Pay with G1.
# pub.dev using `pub publish`. This is preferred for private packages. # pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.9+16 version: 0.0.9+17
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'