-
Notifications
You must be signed in to change notification settings - Fork 116
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
example for get_storage(module, function, params) please #3
Comments
Yeah thank you. We won't be merging that. We hope to finish that by the end of the year. |
This was not about a pull request to be merged. Please reopen this issue, thanks. |
I cannot get this beast py-substrate-interface/substrateinterface/__init__.py Lines 146 to 147 in 7f64648
working to replicate that simple example https://www.shawntabrizi.com/substrate/querying-substrate-storage-via-rpc/#storage-map-query I would think for one from your team, it would be a quick thing to just write down a Python threeliner example ... how to do the exact same but with your library Thanks a million. |
Here a quick example for the latest Kusama dev node (run with --dev), I used the same account as Shawn did (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY, which result in the public key 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d) If you use hex values as params, you need to omit the '0x', so a quick example will be:
Note that when None is passed as block_hash, it will retrieve the most recent state. Moreover there is a more sophisticated Substrate interface in the making, which will make our life easier by extracting and autofill the 'hasher' and 'return_scale_type' from the runtime metadata and will do the account decoding to public key automatically. |
Ohhhh, thank you sooooooo much. You won't believe how much I tried. And then it was so easy:
THAT was it. Hoooray, finally the result is not
NOW other things start to make sense too. I can see this in the metadata:
Oh cool, that's useful too:
Thanks, well done. And the "more sophisticated Substrate interface in the making" sounds great. Now my next challenge is to read and write my own storage objects. In Python. I would expect to be able to use the same API function at least for reading the data, no? How would I access this through your library?
The metadata section says this:
via https://polkadot.js.org/apps/ I can write that extrinsics Meta: All the tutorials, e.g. the substratekitties tutorial, are targeted at JavaScript only. What I am really missing here is one supersimple tutorial, which creates the simplemost substrate node (by now, I understood how to do that, but it took ages), which can only do 1 thing: just read and store/overwrite one integer - without fancy GUI and stuff, just showing the whole procedure from scratch, possibly even only with Of course, what you are doing here, for us Pythonians, is super valuable. Hide the low levels. Great. Really looking forward to when it's ready. But for now the above would be everything I need short term. So if you could give me one more hint, that would be great. Thanks! |
Hah! I got it, result 42 is:
Yipppieh. And ... wow, I see the light ...
turns it into:
Great. What solved it:
then it worked. Great. Now I have to learn how to store values, talking to But that is NOT part of the current |
Anyways, just want to say thanks again. Traveling now, continue probably end of next week. Thanks. CanClose. |
Sure np! |
I have been going through all the functions:
Now that worked all very well. Thanks a lot. Makes my life much easier.
The last one could benefit from one small improvement, see that feature request.
However, this remaining 1, I could not yet get working:
results in
Which is better than an exception, so the query seems to be well-formed at least; it is just asking for the wrong thing probably? Following Shawn's tutorial, it should accept a list of parameters, right? But it doesn't want to take a list.
I have tried some permutations of possible parameters, using the instructions over there; but obviously I have't understood the role of the arguments (module, function, params) yet.
For most of your other functions in this library, we can live well without unittests - but please you give one or two working examples for
get_storage()
. Perhaps connecting to "https://dev-node.substrate.dev:9933/" because then I can easily replicate it here.Thanks. A lot.
The text was updated successfully, but these errors were encountered: