start method
This method will be called while App switched to a plugin. In this method, the plugin will:
- connect to nodes.
- retrieve network const & state.
- subscribe balances & set balancesStore.
Implementation
Future<NetworkParams?> start(Keyring keyring,
{List<NetworkParams>? nodes}) async {
final res = await sdk.api.connectNode(keyring, nodes ?? nodeList);
if (res == null) return null;
keyring.setSS58(res.ss58);
await updateNetworkState();
if (keyring.current.address != null) {
sdk.api.account.subscribeBalance(keyring.current.address,
(BalanceData data) {
_updateBalances(keyring.current, data);
});
}
onStarted(keyring);
return res;
}