Skip to content
Snippets Groups Projects
Commit fe76beaa authored by poka's avatar poka
Browse files

Merge branch 'balanceMultiqueries' into dev

parents 611d715d 5e2d4c46
No related branches found
No related tags found
No related merge requests found
Pipeline #34055 waiting for manual action
...@@ -93,7 +93,7 @@ class SubstrateSdk with ChangeNotifier { ...@@ -93,7 +93,7 @@ class SubstrateSdk with ChangeNotifier {
try { try {
return await sdk.webView!.evalJavascript('api.query.$call'); return await sdk.webView!.evalJavascript('api.query.$call');
} catch (e) { } catch (e) {
log.i("catched _getStorage error"); log.e("_getStorage error: $e");
return Future(() {}); return Future(() {});
} }
} }
...@@ -200,6 +200,16 @@ class SubstrateSdk with ChangeNotifier { ...@@ -200,6 +200,16 @@ class SubstrateSdk with ChangeNotifier {
return balanceRatio; return balanceRatio;
} }
Future getBalanceMulti(List addresses) async {
List stringifyAddresses = [];
for (var element in addresses) {
stringifyAddresses.add('"$element"');
}
final List balanceGlobal =
await _getStorage('system.account.multi($stringifyAddresses)');
log.d('debug multi: $balanceGlobal');
}
Future<Map<String, double>> getBalance(String address) async { Future<Map<String, double>> getBalance(String address) async {
if (!nodeConnected) { if (!nodeConnected) {
return { return {
......
...@@ -118,6 +118,15 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -118,6 +118,15 @@ class _HomeScreenState extends State<HomeScreen> {
isTall = true; isTall = true;
ratio = 1.125; ratio = 1.125;
} }
//TODO: finish to implement multiqueries
// final sub = Provider.of<SubstrateSdk>(context, listen: false);
// sub.getBalanceMulti([
// '5CQ8T4qpbYJq7uVsxGPQ5q2df7x3Wa4aRY6HUWMBYjfLZhnn',
// '5Dq8xjvkmbz7q4g2LbZgyExD26VSCutfEc6n4W4AfQeVHZqz'
// ]);
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
drawer: MainDrawer(isWalletsExists: isWalletsExists), drawer: MainDrawer(isWalletsExists: isWalletsExists),
......
...@@ -145,6 +145,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -145,6 +145,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
// TODO: about keyboard dismiss issue, should try this: https://stackoverflow.com/a/76352647/8301867
return DropdownButton( return DropdownButton(
dropdownColor: const Color(0xffffeed1), dropdownColor: const Color(0xffffeed1),
elevation: 12, elevation: 12,
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment