init method
param jsCode
is customized js code of parachain,
the api works without jsCode
param in Kusama/Polkadot.
Implementation
Future<void> init(
Keyring keyring, {
WebViewRunner? webView,
String? jsCode,
}) async {
final c = Completer();
_service = SubstrateService();
await _service.init(
keyring,
webViewParam: webView,
jsCode: jsCode,
onInitiated: () {
// inject keyPairs after webView launched
_service.keyring.injectKeyPairsToWebView(keyring);
// and initiate pubKeyIconsMap
api.keyring.updatePubKeyIconsMap(keyring);
if (!c.isCompleted) {
c.complete();
}
},
);
api = Web3WalletApi(_service);
return c.future;
}