Skip to content

polkawallet-io/polkawallet_plugin_acala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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