parachain.dart 862 B

1234567891011121314151617181920212223242526272829
  1. import 'dart:async';
  2. import 'package:polkawallet_sdk/service/index.dart';
  3. class ServiceParachain {
  4. ServiceParachain(this.serviceRoot);
  5. final SubstrateService serviceRoot;
  6. Future<Map?> queryParasOverview() async {
  7. final res = await serviceRoot.webView!
  8. .evalJavascript('parachain.queryParasOverview(api)') as Map?;
  9. return res;
  10. }
  11. Future<Map?> queryAuctionWithWinners() async {
  12. final res = await serviceRoot.webView!
  13. .evalJavascript('parachain.queryAuctionWithWinners(api)') as Map?;
  14. return res;
  15. }
  16. Future<List<String>> queryUserContributions(
  17. List<String> paraIds, String pubKey) async {
  18. final res = await serviceRoot.webView!.evalJavascript('Promise.all(['
  19. '${paraIds.map((e) => 'parachain.queryUserContributions(api, "$e", "$pubKey")').join(',')}])');
  20. return List<String>.from(res);
  21. }
  22. }