type 'Id' is not a subtype of type 'MultiAddress' #441
-
Hello ! What could be the reason for this error. I tried to connect to a Substrate node based on the substrate Node template. On Dart side I tried to run the example based on the generated files from the Substrate Node template Example of dart the binary file for my generated files after running the ** polkadart_cli command** but I got the error type 'Id' is not a subtype of type 'MultiAddress'. The files are correctly generated and the example with Polkadot chain worked fine but for the substrate node template that's the error I got. Here are the versions of polkadart, cli, ... on pubspec file polkadart: ^0.3.1
polkadart_keyring: ^0.3.0
polkadart_cli: ^0.3.1 here is the link of the gist dart file used to interact with the node. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
Hello @web3-sante, The types are generated by You can easily check the available types with the IDE autocomplete by typing: MultiAddress.values. Btw, you can also create the |
Beta Was this translation helpful? Give feedback.
-
Thanks @leonardocustodio for the feedback. For now I do not have any pallet configured just the default pallets configured on the node template. The values are pretty much the same as what you get by doing autocomplete.. |
Beta Was this translation helpful? Give feedback.
-
Interesting, it could be a bug after all. I will run a template node and check it out later today. |
Beta Was this translation helpful? Give feedback.
-
yup sounds good |
Beta Was this translation helpful? Give feedback.
-
Interesting, I've just run a template node here and it worked fine. Did you add the node in the polkadart:
output_dir: lib/generated
chains:
polkadot: ws://127.0.0.1:9944 |
Beta Was this translation helpful? Give feedback.
-
Yes I have done that, all the files are generated correctly but the problem comes when try to run the examples in the gist file. To be exact at this part: final publicKey = hex.encode(keyring.publicKey.bytes);
print('Public Key: $publicKey');
final dest = $MultiAddress().id(hex.decode(publicKey));
final runtimeCall = api.tx.balances.transferAll(dest: dest, keepAlive: true);
print('Runtime call: $runtimeCall'); |
Beta Was this translation helpful? Give feedback.
-
I understand but that's the thing, I copied and pasted your Public Key: d0c5fca112207646534d8a8896f0e7ba6711b5e82e761320f09c7bf249db3221
Runtime call: Instance of 'Balances'
Encoded call: 040400d0c5fca112207646534d8a8896f0e7ba6711b5e82e761320f09c7bf249db322101
Payload: 040400d0c5fca112207646534d8a8896f0e7ba6711b5e82e761320f09c7bf249db322101050100006400000001000000d0eb2aa35f6bb55176c5043d62d9b50f3a5472aa87c5af7dafd70ae58a4bc69d6a0ef5be5af855f584711acc60008f8bb73ab8a2a2c01de73c731b642797f36d
Signature: 38cc3b12ec95f8305d0974fb10af86c9c1a480aa346bb04abd8633100c14c149dd8868376091eeea65e8513104c11e389a84b5b3beb7ca3a3af02b453417f284
Extrinsic: 2d028400d0c5fca112207646534d8a8896f0e7ba6711b5e82e761320f09c7bf249db32210138cc3b12ec95f8305d0974fb10af86c9c1a480aa346bb04abd8633100c14c149dd8868376091eeea65e8513104c11e389a84b5b3beb7ca3a3af02b453417f28405010000040400d0c5fca112207646534d8a8896f0e7ba6711b5e82e761320f09c7bf249db322101
Unhandled exception:
Exception: {code: 1010, message: Invalid Transaction, data: Inability to pay some fees (e.g. account balance too low)} Are you sure your import is correct? The only thing I changed in the gist was the imports as I generated with another name, but it seems to be the same as yours: import 'package:polkadart_example/generated/polkadot/polkadot.dart';
import 'package:polkadart_example/generated/polkadot/types/sp_runtime/multiaddress/multi_address.dart'; Maybe you could be using an older version of the packages? Try running: |
Beta Was this translation helpful? Give feedback.
-
Alright ! Let me try to upgrade versions |
Beta Was this translation helpful? Give feedback.
-
@leonardocustodio Indeed. I suspect the reason was the fact that the polkadart: ^0.2.6
polkadart_keyring: ^0.2.1
polkadart_cli: ^0.2.4 But Now it works! Thank you for the support 👍 |
Beta Was this translation helpful? Give feedback.
@leonardocustodio Indeed. I suspect the reason was the fact that the☹️ .
polkadart
andpolkadart_cli
packages used were not the latest. I was testing it on 2 projects and one got old versions I don't know howBut Now it works!
Thank you for the support 👍