fix: Use _removableOn instead of _renewableOn for certification renewale delay (#13)
This commit is contained in:
parent
fd9467ef79
commit
c58d859d07
|
@ -2,5 +2,4 @@
|
||||||
"wss://gdev.librelois.fr/ws",
|
"wss://gdev.librelois.fr/ws",
|
||||||
"wss://gdev.1000i100.fr/ws",
|
"wss://gdev.1000i100.fr/ws",
|
||||||
"wss://gdev.komun.org/ws"
|
"wss://gdev.komun.org/ws"
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -524,7 +524,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
|
|
||||||
if (idtyStatus != null) {
|
if (idtyStatus != null) {
|
||||||
final String _status = idtyStatus['status'];
|
final String _status = idtyStatus['status'];
|
||||||
log.d('Status $address: $_status');
|
// log.d('Status $address: $_status');
|
||||||
return (_status);
|
return (_status);
|
||||||
} else {
|
} else {
|
||||||
return 'expired';
|
return 'expired';
|
||||||
|
@ -605,39 +605,27 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, int>> certState(String from, String to) async {
|
Future<Map<String, int>> certState(String from, String to) async {
|
||||||
// String from = await getMemberAddress();
|
|
||||||
if (from != to && await isMember(from)) {
|
|
||||||
Map<String, int> _result = {};
|
Map<String, int> _result = {};
|
||||||
|
if (from != to && await isMember(from)) {
|
||||||
final _certData = await getCertData(from, to);
|
final _certData = await getCertData(from, to);
|
||||||
final _certMeta = await getCertMeta(from);
|
final _certMeta = await getCertMeta(from);
|
||||||
final int _removableOn = _certData['removableOn'] ?? 0;
|
final int _removableOn = _certData['removableOn'] ?? 0;
|
||||||
final int _renewableOn = _certData['renewableOn'] ?? 0;
|
|
||||||
final int _nextIssuableOn = _certMeta['nextIssuableOn'] ?? 0;
|
final int _nextIssuableOn = _certMeta['nextIssuableOn'] ?? 0;
|
||||||
//TODO: use _removableOn instead of _renewableOn
|
final certRemovableDuration = (_removableOn - blocNumber) * 6;
|
||||||
log.d(_renewableOn.toString() +
|
const int renewDelay = 2 * 30 * 24 * 3600; // 2 months
|
||||||
'\n' +
|
|
||||||
_removableOn.toString() +
|
if (certRemovableDuration >= renewDelay) {
|
||||||
'\n' +
|
final certRenewDuration = certRemovableDuration - renewDelay;
|
||||||
_nextIssuableOn.toString());
|
|
||||||
if (_renewableOn != 0) {
|
|
||||||
final certRenewDuration = (_renewableOn - blocNumber) * 6;
|
|
||||||
_result.putIfAbsent('certRenewable', () => certRenewDuration);
|
_result.putIfAbsent('certRenewable', () => certRenewDuration);
|
||||||
return _result;
|
|
||||||
} else if (_nextIssuableOn > blocNumber) {
|
} else if (_nextIssuableOn > blocNumber) {
|
||||||
final certDelayDuration = (_nextIssuableOn - blocNumber) * 6;
|
final certDelayDuration = (_nextIssuableOn - blocNumber) * 6;
|
||||||
_result.putIfAbsent('certDelay', () => certDelayDuration);
|
_result.putIfAbsent('certDelay', () => certDelayDuration);
|
||||||
return _result;
|
|
||||||
} else {
|
} else {
|
||||||
_result.putIfAbsent('canCert', () => 0);
|
_result.putIfAbsent('canCert', () => 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Future<String> certState(String from, String to) async {
|
|
||||||
// return '';
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<Map> getCertMeta(String address) async {
|
Future<Map> getCertMeta(String address) async {
|
||||||
var idtyIndex = await sdk.webView!
|
var idtyIndex = await sdk.webView!
|
||||||
|
@ -648,7 +636,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
'';
|
'';
|
||||||
// if (_certMeta['nextIssuableOn'] != 0) return {};
|
// if (_certMeta['nextIssuableOn'] != 0) return {};
|
||||||
|
|
||||||
log.d(_certMeta);
|
// log.d(_certMeta);
|
||||||
return _certMeta;
|
return _certMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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+12
|
version: 0.0.9+13
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
Loading…
Reference in New Issue