polkawallet-io / polkawallet_plugin_acala

Acala plugin for Polkawallet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

polkawallet_plugin_acala

Acala network plugin for polkawallet.

Usage

To install the package:

  polkawallet_plugin_acala:
    git:
      url: https://github.com/polkawallet-io/polkawallet_plugin_acala.git
      ref: master

To start the plugin:

class _MyAppState extends State<MyApp> {

  /// The Keyring instance manages the local keyPairs
  /// with dart package `get_storage`
  final _keyring = Keyring();

  /// The PluginAcala instance connects remote node
  /// and provides APIs from acala.js
  PolkawalletPlugin _network = PluginAcala();

  Future<void> _startPlugin() async {
    /// Waiting for Keyring local storage initiate.
    await _keyring.init();

    /// Waiting for PluginAcala load js code
    /// and start a hidden webView to run `acala.js`.
    await _network.beforeStart(_keyring);

    /// Calling `PluginAcala(Keyring)` to
    /// connect to remote acala node.
    final connected = await _network.start(_keyring);

    _setConnectedNode(connected);
  }

  //...
}

The PluginAcala will query token balances of accounts of Keyring while plugin started.

To query other data from network, call: _network.api

About

Acala plugin for Polkawallet.

License:Apache License 2.0


Languages

Language:Dart 86.0%Language:TypeScript 13.4%Language:Ruby 0.4%Language:Swift 0.1%Language:JavaScript 0.1%Language:Kotlin 0.0%Language:Objective-C 0.0%