Skip to content
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

compose_call only works with dest=PUB_KEY #8

Closed
drandreaskrueger opened this issue Mar 7, 2020 · 4 comments
Closed

compose_call only works with dest=PUB_KEY #8

drandreaskrueger opened this issue Mar 7, 2020 · 4 comments

Comments

@drandreaskrueger
Copy link

When playing with

compose_call( Balances, transfer, {'dest': dest,'value': value} )

I got a lot of errors like

ValueError: Invalid checksum
ValueError: Invalid address length
ValueError: Invalid account index length

until I realized that I cannot (?) send to an

address (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY) 

but must use the

PUB_KEY (0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d)

instead, for the dest:

payload = substrate.compose_call(call_module='Balances',
                                 call_function='transfer',
                                 call_params={'dest': dest,
                                              'value': value})

I suggest, you mention that the https://github.com/polkascan/py-substrate-interface#compose-call explanations?

@drandreaskrueger
Copy link
Author

P.S.: Please also see paritytech/substrate#5180 perhaps you have ideas how to solve it? Thanks.

@arjanz
Copy link
Member

arjanz commented Mar 7, 2020

It should auto-detect the address format, but you were right, there was an issue with the auto-detection of whether the given argument is a public key, SS58 encoded AccountId or SS58 encoded AccountIndex. I assumed the SS58 encoded AccountId is always 47 chars long, but this was not the case.

Thanks for the feedback, I fixed it in polkascan/py-scale-codec@650723e so with a new pip install it should be fixed.

Regarding your comment about subkey, I also asked a question in the Riot group 'Substrate Technical', but no answers there unfortunately. We also want to implement signing, so as soon as I have a solution I'll let you know.

@arjanz arjanz closed this as completed Mar 7, 2020
@drandreaskrueger
Copy link
Author

so with a new pip install it should be fixed.

Oh wow, you're a star. That was VERY quick. Thanks a million!

@drandreaskrueger
Copy link
Author

I also asked a question in the Riot group 'Substrate Technical',

Thanks a lot, @arjanz - any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants