polkawallet-io / polkawallet-flutter

Replace to: https://github.com/polkawallet-io/app
Apache License 2.0
110 stars 49 forks source link

Unknown types found #19

Closed ltfschoen closed 4 years ago

ltfschoen commented 4 years ago

I've added a custom chain in app/lib/page/profile/settings/remoteNodeListPage.dart using Polkawallet-Flutter https://github.com/polkawallet-io/polkawallet-flutter, but when I run the app in Android Studio it's giving an error that I haven't defined the custom types (i.e. RoamingOperatorIndex, etc):

[ +130 ms] I/chromium(12339): [INFO:CONSOLE(23)] "2020-05-13 13:18:37        API/INIT: Error: FATAL: Unable to initialize the API: createType(RoamingOperatorIndex):: Cannot construct unknown type RoamingOperatorIndex", source:  (23)
[+34304 ms] I/chromium(12339): [INFO:CONSOLE(23)] "2020-05-13 13:19:11          API-WS: disconnected from wss://testnet-frankfurt-v0.1.0-alpha.datahighway.com code: '1006' reason: ''", source:  (23)
[+3186 ms] I/chromium(12339): [INFO:CONSOLE(23)] "2020-05-13 13:19:15        API/INIT: Connection to new genesis detected, re-initializing", source:  (23)
[+8748 ms] I/chromium(12339): [INFO:CONSOLE(23)] "Unknown types found, no types for MiningSpeedBoostConfigurationHardwareMining,

Where can I defined the custom types in the Polkawallet-Flutter codebase for connecting to a custom chain? (i.e. in Polkadot.js Apps I just go to https://polkadot.js.org/apps/#/settings/developer, and paste my custom types there)

FYI, these are my custom types: https://github.com/DataHighway-DHX/node/blob/master/custom_types.json

RomeroYang commented 4 years ago

You may find lib/js_service_kusama and lib/js_service_acala in branch develop, that's because the app doesn't handle Types itself, it runs js SDK in a hidden webview to codec the substrate types. So we have a polkadot.js for KUSAMA, and another polkadot.js for Acala.

For your case, you need to use a customized polkadot.js sdk with your custom_types.json built in, as acala.js did.