Skip to content
Snippets Groups Projects
Commit c8933fd5 authored by guenoel's avatar guenoel Committed by poka
Browse files

fix: parse double to int in initCurrencyParameters for iPhone

parent 532a004f
No related branches found
Tags v0.1.7+78
1 merge request!56Fix/build ios
Pipeline #18837 waiting for manual action
......@@ -96,10 +96,19 @@ class SubstrateSdk with ChangeNotifier {
}
}
Future _getStorageConst(String call) async {
return (await sdk.webView!
Future<int> _getStorageConst(String call) async {
final result = (await sdk.webView!
.evalJavascript('api.consts.$call', wrapPromise: false) ??
[null])[0];
return checkInt(result) ?? 0;
}
int? checkInt(dynamic value) {
if (value is int) return value;
if (value is double) return value.toInt();
if (value is String) return int.tryParse(value);
return null;
}
Future<TxSenderData> _setSender(String address) async {
......@@ -396,7 +405,7 @@ class SubstrateSdk with ChangeNotifier {
currencyParameters['certValidityPeriod'] =
await _getStorageConst('cert.validityPeriod.words');
} catch (e) {
log.i('error while getting storageVals (network?)');
log.i('error while getting storageVals (network?) :: $e');
}
log.i('currencyParameters: $currencyParameters');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment