-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate extrinsic classes #315
Conversation
5e8278b
to
35ede1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! remember to increment the package version and update the CHANGELOG.md
with a description of the new features.
186e2ed
to
f6331d2
Compare
If I'm allowed to ask guys just wondering if you about accept this PR when it might be merged ? I was seeking for a weeks for this sort of solution:) |
Hello @kemalinnowise , Right now it only generates an encoded call and the payload to sign. Is that enough for you? If so we can merge it already. |
Hi @leonardocustodio ! |
packages/polkadart/lib/extrinsic/signed_extensions/substrate.dart
Outdated
Show resolved
Hide resolved
@leonardocustodio Hi! Hope U doing well! |
Hello @kemalinnowise, unfortunately I was not able to finish this yet. But you can use this branch directly and here is an example on how you can accomplish what you want (create signed extrinsics):
Please note a few of those stuff were added to a helper method in this branch. |
I appreciate your response! |
Actually, I talked with my manager and he allowed me to help you. I just not good at substrate and blockchain. But this feature is critical in our project, so if you accept my help and ready to outsource some work to me, I'm ready. |
Sure, that would be great. Can you check if you can make a fully working extrinsic first using the method above? |
My suggestion to import polkadart in your project at this moment would be clone the whole repository inside your project folder in a
|
I've tried specified approach however given errors won't allow me to proceed: Because every version of substrate_metadata from path depends on polkadart_scale_codec from hosted and sandbox depends on polkadart_scale_codec from path, substrate_metadata from path is forbidden.
So, because sandbox depends on substrate_metadata from path, version solving failed.
Also I've tried to use various options depending on some of packages separately won't work as well P.S. Is there any option to communicate with you via Discord or whatever for more convenience ? |
Here is a demo project which you can use to learn how to setup. Please note you need |
Hello! I downloaded the demo project and configured the dependencies from the repository, everything run and works for me except for the generation in my projects pubcpec.yaml I use the following to generate Mychain instead Poladot: So I've tried replace this lines in demo project with one from my project and run: dart pub run polkadart_cli:generate -v The command line throws given error: ➜ sandbox dart pub run polkadart_cli:generate -v
FINE: Pub 3.1.0
MSG : Deprecated. Use `dart run` instead.
FINE: Package Config up to date.
FINE: Package Config up to date.
MSG : Building package executable...
IO : Created temp directory ./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov
IO : Copying "./.dart_tool/pub/incremental/polkadart_cli/generate.dart.incremental.dill" to "./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov/generate.dart.incremental.dill.temp".
IO : Renaming "./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov/generate.dart.incremental.dill.temp" to "./.dart_tool/pub/incremental/polkadart_cli/generate.dart.incremental.dill".
IO : Deleting directory ./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov.
ERR : Failed to build polkadart_cli:generate:
| ../../../.pub-cache/hosted/pub.dev/watcher-1.0.2/lib/src/constructable_file_system_event.dart:7:57: Error: The class 'FileSystemEvent' can't be extended, implemented, or mixed in outside of its library because it's a sealed class.
| abstract class _ConstructableFileSystemEvent implements FileSystemEvent {
| ^
FINE: Exception type: ApplicationException
FINE: package:pub/src/dart.dart 170:7 precompile
| ===== asynchronous gap ===========================
| dart:async Future.catchError
| package:pub/src/utils.dart 155:21 waitAndPrintErrors.<fn>
| dart:async Future.wait
| package:pub/src/utils.dart 153:17 waitAndPrintErrors
| package:pub/src/entrypoint.dart 515:14 Entrypoint.precompileExecutable.<fn>
| package:pub/src/log.dart 437:18 progress
| package:pub/src/entrypoint.dart 513:15 Entrypoint.precompileExecutable
| package:pub/src/command/run.dart 107:26 RunCommand.runProtected.<fn>.<fn>
| package:pub/src/log.dart 420:32 errorsOnlyUnlessTerminal
| package:pub/src/command/run.dart 106:38 RunCommand.runProtected.<fn>
| package:pub/src/executable.dart 97:22 runExecutable
| ===== asynchronous gap ===========================
| dart:async _CustomZone.registerUnaryCallback
| package:pub/src/executable.dart 79:24 runExecutable
| package:pub/src/command/run.dart 100:26 RunCommand.runProtected
| ===== asynchronous gap ===========================
| dart:async _CustomZone.registerUnaryCallback
| package:pub/src/command/run.dart 61:7 RunCommand.runProtected
| package:pub/src/command.dart 199:21 PubCommand.run.<fn>
| dart:async new Future.sync
| package:pub/src/utils.dart 114:12 captureErrors.wrappedCallback
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 131:11 captureErrors
| package:pub/src/command.dart 198:13 PubCommand.run
| package:args/command_runner.dart 212:27 CommandRunner.runCommand
| package:dartdev/dartdev.dart 240:30 DartdevRunner.runCommand
| package:args/command_runner.dart 122:25 CommandRunner.run.<fn>
| dart:async new Future.sync
| package:args/command_runner.dart 122:14 CommandRunner.run
| package:dartdev/dartdev.dart 59:29 runDartdev
| /opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart 11:9 main
FINE: Building package executable finished (0.644s).
---- Log transcript ----
FINE: Pub 3.1.0
MSG : Deprecated. Use `dart run` instead.
FINE: Package Config up to date.
FINE: Package Config up to date.
MSG : Building package executable...
IO : Created temp directory ./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov
IO : Copying "./.dart_tool/pub/incremental/polkadart_cli/generate.dart.incremental.dill" to "./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov/generate.dart.incremental.dill.temp".
IO : Renaming "./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov/generate.dart.incremental.dill.temp" to "./.dart_tool/pub/incremental/polkadart_cli/generate.dart.incremental.dill".
IO : Deleting directory ./.dart_tool/pub/incremental/polkadart_cli/tmpDHhEov.
ERR : Failed to build polkadart_cli:generate:
| ../../../.pub-cache/hosted/pub.dev/watcher-1.0.2/lib/src/constructable_file_system_event.dart:7:57: Error: The class 'FileSystemEvent' can't be extended, implemented, or mixed in outside of its library because it's a sealed class.
| abstract class _ConstructableFileSystemEvent implements FileSystemEvent {
| ^
FINE: Exception type: ApplicationException
FINE: package:pub/src/dart.dart 170:7 precompile
| ===== asynchronous gap ===========================
| dart:async Future.catchError
| package:pub/src/utils.dart 155:21 waitAndPrintErrors.<fn>
| dart:async Future.wait
| package:pub/src/utils.dart 153:17 waitAndPrintErrors
| package:pub/src/entrypoint.dart 515:14 Entrypoint.precompileExecutable.<fn>
| package:pub/src/log.dart 437:18 progress
| package:pub/src/entrypoint.dart 513:15 Entrypoint.precompileExecutable
| package:pub/src/command/run.dart 107:26 RunCommand.runProtected.<fn>.<fn>
| package:pub/src/log.dart 420:32 errorsOnlyUnlessTerminal
| package:pub/src/command/run.dart 106:38 RunCommand.runProtected.<fn>
| package:pub/src/executable.dart 97:22 runExecutable
| ===== asynchronous gap ===========================
| dart:async _CustomZone.registerUnaryCallback
| package:pub/src/executable.dart 79:24 runExecutable
| package:pub/src/command/run.dart 100:26 RunCommand.runProtected
| ===== asynchronous gap ===========================
| dart:async _CustomZone.registerUnaryCallback
| package:pub/src/command/run.dart 61:7 RunCommand.runProtected
| package:pub/src/command.dart 199:21 PubCommand.run.<fn>
| dart:async new Future.sync
| package:pub/src/utils.dart 114:12 captureErrors.wrappedCallback
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 131:11 captureErrors
| package:pub/src/command.dart 198:13 PubCommand.run
| package:args/command_runner.dart 212:27 CommandRunner.runCommand
| package:dartdev/dartdev.dart 240:30 DartdevRunner.runCommand
| package:args/command_runner.dart 122:25 CommandRunner.run.<fn>
| dart:async new Future.sync
| package:args/command_runner.dart 122:14 CommandRunner.run
| package:dartdev/dartdev.dart 59:29 runDartdev
| /opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart 11:9 main
FINE: Building package executable finished (0.644s).
---- End log transcript ----
IO : Writing 10340 characters to text file /Users/kemal/.pub-cache/log/pub_log.txt.
MSG : Logs written to /Users/kemal/.pub-cache/log/pub_log.txt.
|
Sorry that was my bad. For some reason watcher won't work properly, I fixed bug and now things work fine on my side. Seems to me Existing changes is enough for my project) What is the next steps, how can I be helpful ? |
Also I try replace your example with my and got given error while generate classes: lib/generated/mychain/pallets/evm.dart:128:35: Error: The method 'call' isn't defined for the class '$Call'.
- '$Call' is from 'package:sandbox/generated/mychain/types/pallet_evm/pallet/call.dart' ('lib/generated/mychain/types/pallet_evm/pallet/call.dart').
Try correcting the name to the name of an existing method, or defining a method named 'call'.
final _call = _i8.Call.values.call(
^^^^ And one more thing: final extrinsic = Extrinsic(
signer: publicKey,
method: call,
signature: hexSignature,
era: era,
nonce: nonce,
tip: tip)
.encode(api.registry);
final hexExtrinsic = hex.encode(extrinsic);
print('Extrinsic: $hexExtrinsic');
// 2d0284006802f945419791d3138b4086aa0b2700abb679f950e2721fd7d65b5d1fdf8f0201d19e04fc1a4ec115ec55d29e53676ddaeae0467134f9513b29ed3cd6fd6cd551a96c35b92b867dfd08ba37417e5733620acc4ad17c1d7c65909d6edaaffd4d0e0028000a03008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48a10f Where to send this serialised extrinsic ? |
This would give you an encoded call:
Where
And this |
That's actually one thing that you can help out if you wish. Basically, you need to make a RPC call to |
Hi there, maintainer of https://github.com/encointer/encointer-wallet-flutter here. We want to get rid of our unstable webView that runs a Once this PR is merged, we would love to try out your lib! Is there any estimate, is this still being worked on? |
Hello @clangenb , yes we have resumed the development and our ETA for our next milestone is in about two months, here is the list of things that will be released in this next milestone:
|
Awesome thanks for the swift reply - cool features are in the pipeline! What I can't see in this milestone list is extrinsic creation and calling the author RPC to submit the extrinsic and listen for tx status updates (so essentially work that builds upon this PR), do you also have some info regarding this? |
Yep, all that is included in this same milestone but signing the extrinsics
only with ed25519 will be supported by now,. For sr25519 it will be in the
next milestone that should be delivered next year.
…On Fri, 6 Oct 2023 at 09:06 clangenb ***@***.***> wrote:
Awesome thanks for the swift reply - cool features are in the pipeline!
What I can't see in this milestone list is extrinsic creation and calling
the author RPC to submit the extrinsic and listen for tx status updates (so
essentially work that builds upon this PR), do you also have some info
regarding this?
—
Reply to this email directly, view it on GitHub
<#315 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABK374HRIQN2VKKJCCJ5KYTX57X3VAVCNFSM6AAAAAA2FIEQXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJQGUZDQNZTGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Awesome, thank you so much for all these updates. I was curious about your library and started integrating the current state into our codebase and generated some types just to get a feeling about it - works flawlessly so far. My current endeavour is to send an already signed and scale-encoded extrinsic to our chain and listen for the extrinsic status updates. As I have found your library meanwhile, I might use your state/system apis as an inspiration and implement parts of the author api analogously to them. If your interested, I could maybe upstream it. |
prs are always welcome, feel free to send any if you want to 😄 |
608478d
to
18fecfd
Compare
@clangenb, you can now |
Hi there, thanks a lot! I have also made my own implementation meanwhile, as I needed quite some boilerplate around sending the extrinsic and moreover finding out whether the extrinsic was a success or not. Some of the code is a bit opinionated, so I am not sure if it fits in a library like polkadart, but you can have a look at it if you like: encointer/encointer-wallet-flutter#1529. This file might be of interest to you in particular: https://github.com/encointer/encointer-wallet-flutter/blob/831bd4638b002c567707dadc6e7eaad022d4be12/app/lib/service/tx/lib/src/send_tx_dart.dart |
* add lock and unlock * update _locked * fix stuck CI build failing * dummy test * add test cases for pairs_test * add equality check for keypair * improvements and functionality addition * fix tests * keypair tests * tests for keyring class * changes in test
Milestone
Example: