feat: start to implement RPC multiqueries
This commit is contained in:
parent
611d715ded
commit
2301472567
|
@ -93,7 +93,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
try {
|
||||
return await sdk.webView!.evalJavascript('api.query.$call');
|
||||
} catch (e) {
|
||||
log.i("catched _getStorage error");
|
||||
log.e("_getStorage error: $e");
|
||||
return Future(() {});
|
||||
}
|
||||
}
|
||||
|
@ -200,6 +200,16 @@ class SubstrateSdk with ChangeNotifier {
|
|||
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 {
|
||||
if (!nodeConnected) {
|
||||
return {
|
||||
|
|
|
@ -118,6 +118,15 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
isTall = true;
|
||||
ratio = 1.125;
|
||||
}
|
||||
|
||||
//TODO: finish to implement multiqueries
|
||||
|
||||
// final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
// sub.getBalanceMulti([
|
||||
// '5CQ8T4qpbYJq7uVsxGPQ5q2df7x3Wa4aRY6HUWMBYjfLZhnn',
|
||||
// '5Dq8xjvkmbz7q4g2LbZgyExD26VSCutfEc6n4W4AfQeVHZqz'
|
||||
// ]);
|
||||
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
drawer: MainDrawer(isWalletsExists: isWalletsExists),
|
||||
|
|
|
@ -145,6 +145,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
|
|||
),
|
||||
const SizedBox(height: 10),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
// TODO: about keyboard dismiss issue, should try this: https://stackoverflow.com/a/76352647/8301867
|
||||
return DropdownButton(
|
||||
dropdownColor: const Color(0xffffeed1),
|
||||
elevation: 12,
|
||||
|
|
Loading…
Reference in New Issue