assets.dart 611 B

1234567891011121314151617181920212223
  1. import 'dart:async';
  2. import 'package:polkawallet_sdk/service/index.dart';
  3. class ServiceAssets {
  4. ServiceAssets(this.serviceRoot);
  5. final SubstrateService serviceRoot;
  6. Future<List?> getAssetsAll() async {
  7. final dynamic res =
  8. await serviceRoot.webView!.evalJavascript('assets.getAssetsAll(api)');
  9. return res;
  10. }
  11. Future<List> queryAssetsBalances(List<String> ids, String address) async {
  12. final List res = await serviceRoot.webView!.evalJavascript('Promise.all(['
  13. '${ids.map((e) => 'api.query.assets.account($e, "$address")').join(',')}'
  14. '])');
  15. return res;
  16. }
  17. }